Skip to content

Instantly share code, notes, and snippets.

@Serabe
Created March 15, 2009 19:16
Show Gist options
  • Save Serabe/79510 to your computer and use it in GitHub Desktop.
Save Serabe/79510 to your computer and use it in GitHub Desktop.
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