Skip to content

Instantly share code, notes, and snippets.

@jamesgecko
Created January 16, 2013 03:27
Show Gist options
  • Save jamesgecko/4143d84dd70bd8995fbd to your computer and use it in GitHub Desktop.
Save jamesgecko/4143d84dd70bd8995fbd to your computer and use it in GitHub Desktop.
[19] pry(main)> class Foo
[19] pry(main)* define_method :foo do
[19] pry(main)* puts 'foo'
[19] pry(main)* end
[19] pry(main)* end
=> #<Proc:0xb5897e4c@(pry):33>
[20] pry(main)> Foo.new.foo
foo
=> nil
[21] pry(main)> class Foo
[21] pry(main)* define_method :foo { puts 'foo' }
SyntaxError: unexpected '}', expecting kEND
@jamesgecko
Copy link
Author

Solution:

define_method(:foo) { puts 'foo' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment