Module: HashControl::WritableModel::ClassMethods
- Defined in:
- lib/hash_control/model.rb
Instance Method Summary collapse
Instance Method Details
#key_accessor(name) ⇒ Object
79 80 81 82 83 84 85 86 |
# File 'lib/hash_control/model.rb', line 79 def key_accessor(name) name = name.to_sym return if self.respond_to?(name) class_eval do define_method(name) { @hash[name] } define_method("#{name}=") { |x| @hash[name] = x } end end |