Created
March 15, 2009 19:16
-
-
Save Serabe/79510 to your computer and use it in GitHub Desktop.
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 Module | |
VALID=[:optional, :rest_arg] | |
def is(value) | |
raise ArgumentError, "value must be one of #{VALID.join(',')}" unless VALID.include? value | |
[self,value] | |
end | |
end | |
a = [Range, Fixnum.is :optional, String.is :rest_arg] #=> [Range, [Fixnum, :optional], [String, :rest_arg]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment