Skip to content

Instantly share code, notes, and snippets.

@gnufied
Created October 25, 2011 08:41
Show Gist options
  • Save gnufied/1311881 to your computer and use it in GitHub Desktop.
Save gnufied/1311881 to your computer and use it in GitHub Desktop.
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