Created
September 19, 2012 08:31
-
-
Save vessi/3748438 to your computer and use it in GitHub Desktop.
metaprogramming sample for rubygarage
This file contains hidden or 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
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