Skip to content

Instantly share code, notes, and snippets.

@pmarreck
Created August 22, 2012 00:53
Show Gist options
  • Save pmarreck/6227c14e6f631e6944d7 to your computer and use it in GitHub Desktop.
Save pmarreck/6227c14e6f631e6944d7 to your computer and use it in GitHub Desktop.
Ruby binding madness
# When I try this piece of code...
cm = 'some_class_method'
klass.class_eval do
class << klass
define_method(cm) do |*args, &block|
# ...I get an error 'undefined local variable or method `cm' for #<Class:Fixnum> (NameError)'
# How do I get that context to see the cm variable?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment