Skip to content

Instantly share code, notes, and snippets.

@vessi
Created September 19, 2012 08:31
Show Gist options
  • Save vessi/3748438 to your computer and use it in GitHub Desktop.
Save vessi/3748438 to your computer and use it in GitHub Desktop.
metaprogramming sample for rubygarage
class A
attr_accessor :method_name
def initialize(method_name = "test")
@method_name = method_name
end
def declare_methods(&block)
self.class.send(:define_method, @method_name, &block)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment