Skip to content

Instantly share code, notes, and snippets.

@ievgrafov
Created April 1, 2016 12:34
Show Gist options
  • Save ievgrafov/095a88f7f1f8de66d1746ca878732855 to your computer and use it in GitHub Desktop.
Save ievgrafov/095a88f7f1f8de66d1746ca878732855 to your computer and use it in GitHub Desktop.
example_for_calling_exact_method_for_class_with_several_mixins
module A
def a
puts 'A'
end
end
module B
def a
puts 'B'
end
end
class C
include A
include B
end
c = C.new
c.a
# B
B.instance_method(:a).bind(c).call
# B
A.instance_method(:a).bind(c).call
# A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment