Skip to content

Instantly share code, notes, and snippets.

@danielsdeleo
Created July 4, 2009 22:51
Show Gist options
  • Save danielsdeleo/140760 to your computer and use it in GitHub Desktop.
Save danielsdeleo/140760 to your computer and use it in GitHub Desktop.
irb(main):001:0> class A
irb(main):002:1> def foo
irb(main):003:2> puts "class A's foo is a bar"
irb(main):004:2> end
irb(main):005:1> end
=> nil
irb(main):006:0> module B
irb(main):007:1> def foo
irb(main):008:2> puts "mod B's foo is a baz"
irb(main):009:2> end
irb(main):010:1> end
=> nil
irb(main):011:0> a = A.new
=> #<A:0x11ae9a0>
irb(main):012:0> a.extend B
=> #<A:0x11ae9a0>
irb(main):013:0> a.foo
mod B's foo is a baz
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment