Created
September 2, 2015 19:39
-
-
Save cubicool/12650e93f6f77dbeb18e to your computer and use it in GitHub Desktop.
Binding in extended Class definition.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ExtraMethods | |
def def_foo | |
# b = binding | |
# NOTE: The binding acquired here always belongs to ExtraMethods, NOT to | |
# SomeClass, which is what I actually want. | |
end | |
module_function :def_foo | |
end | |
class SomeClass | |
extend ExtraMethods | |
def_foo :bar | |
def_foo :baz | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment