Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@indigoviolet
Created December 23, 2017 05:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indigoviolet/c3a81d44171d9b0db10f3a6b6a0b0e3c to your computer and use it in GitHub Desktop.
Save indigoviolet/c3a81d44171d9b0db10f3a6b6a0b0e3c to your computer and use it in GitHub Desktop.
fin blog embed
class ID < Contracts::CallableClass
def initialize(_)
# We are ignoring the argument here; but we write the argument as a
# string instead of a class in practice to avoid circular reference issues
@actual_contract = Contracts::Or[Contracts::Pos, -1]
end
def valid?(val)
Contract.valid?(val, @actual_contract)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment