Skip to content

Instantly share code, notes, and snippets.

@edzhelyov
Created June 18, 2012 12:31
Show Gist options
  • Save edzhelyov/2948165 to your computer and use it in GitHub Desktop.
Save edzhelyov/2948165 to your computer and use it in GitHub Desktop.
How Ruby methods are resolved
module B
def speak
'B'
end
end
module C
def speak
'C'
end
end
class A
include B
end
puts A.new.speak
A.send :include, C
puts A.new.speak
class A
def speak
'A'
end
end
puts A.new.speak
a = A.new
puts a.speak
def a.speak
'a'
end
puts a.speak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment