Skip to content

Instantly share code, notes, and snippets.

@PJK
Created March 5, 2015 13:26
Show Gist options
  • Save PJK/d5bb928d43fa3d9f291f to your computer and use it in GitHub Desktop.
Save PJK/d5bb928d43fa3d9f291f to your computer and use it in GitHub Desktop.
module M
def x
'M'
end
end
class A
def x
42
end
def self.inherited(klass)
klass.send(:prepend, M)
end
end
class B < A
def x
43
end
end
puts A.new.x
puts B.new.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment