Skip to content

Instantly share code, notes, and snippets.

@midu
Created August 24, 2012 18:21
Show Gist options
  • Select an option

  • Save midu/3453908 to your computer and use it in GitHub Desktop.

Select an option

Save midu/3453908 to your computer and use it in GitHub Desktop.
be careful when you define classes in modules!
class A
def a
"a from A"
end
end
module B; end
class B::A
def a
"a from B"
end
end
class B::C < A
end
module B
class D < A
end
end
B::C.new.a # => "a from A"
B::D.new.a # => "a from B"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment