Skip to content

Instantly share code, notes, and snippets.

@cubicool
Created September 2, 2015 19: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 cubicool/12650e93f6f77dbeb18e to your computer and use it in GitHub Desktop.
Save cubicool/12650e93f6f77dbeb18e to your computer and use it in GitHub Desktop.
Binding in extended Class definition.
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