Module: HasProperties::ClassMethods

Defined in:
lib/has_properties.rb

Instance Method Summary collapse

Instance Method Details

#property(name, type, options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/has_properties.rb', line 18

def property(name, type, options = {})
  define_method name do
    convert_property(property_hash[name.to_s], type, options)
  end

  define_method "#{name}=" do |value|
    property_hash[name.to_s] = convert_property(value, type)
  end
end