Skip to content

Instantly share code, notes, and snippets.

@Serabe
Created March 15, 2009 19:25
Show Gist options
  • Save Serabe/79512 to your computer and use it in GitHub Desktop.
Save Serabe/79512 to your computer and use it in GitHub Desktop.
class Module
VALID=[:optional, :rest_arg]
VALID.each do |x|
define_method x do
[self, x]
end
end
end
a = [Range, Fixnum.optional, String.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