Module: Magi::Proprietary::ClassMethods
- Defined in:
- lib/magi/proprietary.rb
Instance Method Summary collapse
Instance Method Details
#properties ⇒ Object
35 36 37 |
# File 'lib/magi/proprietary.rb', line 35 def properties @properties ||= [] end |
#property(name, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/magi/proprietary.rb', line 13 def property(name, = {}) property = Property.new(name, ) properties << property define_method(name) do properties[name.to_s] end define_method("#{name}=") do |value| properties[name.to_s] = begin case when property.type != :boolean value when value.to_s == "false" false else true end end end end |
#property_names ⇒ Object
39 40 41 |
# File 'lib/magi/proprietary.rb', line 39 def property_names properties.map(&:name) end |