-
-
Save indigoviolet/c3a81d44171d9b0db10f3a6b6a0b0e3c to your computer and use it in GitHub Desktop.
fin blog embed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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