Skip to content

Instantly share code, notes, and snippets.

@shadoi
Created January 15, 2013 01:19
Show Gist options
  • Save shadoi/4535156 to your computer and use it in GitHub Desktop.
Save shadoi/4535156 to your computer and use it in GitHub Desktop.
irb(main):001:0> module MyMod; define_method(:foo) do |test='test', bah| puts test; puts bah; end; end
=> #<Proc:0x00000001bbb470@(irb):1 (lambda)>
irb(main):002:0> include MyMod
=> Object
irb(main):003:0> foo
ArgumentError: wrong number of arguments (0 for 1)
from (irb):1:in `block in <module:MyMod>'
from (irb):3
from /usr/local/bin/irb:12:in `<main>'
irb(main):004:0> foo('asdf')
test
asdf
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment