Class: AtlasClassFactory::GenericClass
- Inherits:
-
Object
- Object
- AtlasClassFactory::GenericClass
- Defined in:
- lib/client/atlas_class_factory.rb
Instance Method Summary collapse
Instance Method Details
#create_class(name) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/client/atlas_class_factory.rb', line 16 def create_class name Object.const_set(name.classify, Class.new do def initialize(hash) hash.each do |k,v| self.instance_variable_set("@#{k}", v) self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")}) self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)}) end end end ) end |