Skip to content

Instantly share code, notes, and snippets.

@banister
Created January 11, 2013 19:23
Show Gist options
  • Save banister/4513230 to your computer and use it in GitHub Desktop.
Save banister/4513230 to your computer and use it in GitHub Desktop.
[1] pry(main)> module MyModule
| def stuff
| include Module.new {
| def my_method
| puts "bar!"
| end
| }
| end
| end
=> nil
[2] pry(main)> class MyClass
| extend MyModule
| stuff
| end
=> MyClass
[3] pry(main)> class MyClass
| def my_method
| puts "foo!"
| super
| end
| end
=> nil
[4] pry(main)> MyClass.new.my_method
foo!
bar!
=> nil
[5] pry(main)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment