Skip to content

Instantly share code, notes, and snippets.

@clicube
Last active December 27, 2015 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clicube/7282906 to your computer and use it in GitHub Desktop.
Save clicube/7282906 to your computer and use it in GitHub Desktop.
なんでこうなるのかわからない
module ModA
def methodA
puts "methodA of ModA called."
end
end
module ModB
include ModA
undef methodA
end
class ClassA
def methodA
puts "methodA of ClassA called."
end
end
a = ClassA.new
a.methodA # => methodA of ClassA called.
a.extend ModB
a.methodA # => NoMethodError
module ModA
def methodA
puts "methodA of ModA called."
end
end
module ModB
include ModA
undef methodA
end
class ClassA
include ModB
def methodA
puts "methodA of ClassA called."
end
end
class ClassB
def methodA
puts "methodA of ClassB called."
end
end
a = ClassA.new
a.methodA # => methodA of ClassA called.
b = ClassB.new
class << b
include ModB
end
b.methodA # => NoMethodError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment