Skip to content

Instantly share code, notes, and snippets.

@kronos
Created February 9, 2010 22:21
Show Gist options
  • Save kronos/299757 to your computer and use it in GitHub Desktop.
Save kronos/299757 to your computer and use it in GitHub Desktop.
meta = Class.new
meta.class_eval {define_method(:foo, Proc.new {||})}
meta.class_eval {define_method(:bar, Proc.new {|x|})}
meta.class_eval {define_method(:baz, Proc.new {|x, y|})}
p meta.new.method(:foo).arity == 0
p meta.new.method(:bar).arity == 1
p meta.new.method(:baz).arity == 2
p proc{|*|}.arity == -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment