Created
October 25, 2011 08:41
-
-
Save gnufied/1311881 to your computer and use it in GitHub Desktop.
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 Foo | |
def self.versions(a) | |
@@versions = a | |
end | |
def build_versions | |
@@versions.each do |key,value| | |
self.instance_eval &value | |
end | |
end | |
def hello(name,age) | |
puts "Hello #{name} and you are #{age} old" | |
end | |
end | |
class Bar < Foo | |
versions( | |
:name => proc { hello('hemant',30) }, | |
:age => proc { hello('Kiran',28) } | |
) | |
end | |
a = Bar.new() | |
a.build_versions() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment