Class: MetaTypes::MetaProperty
- Inherits:
-
Object
- Object
- MetaTypes::MetaProperty
- Defined in:
- lib/meta_types/meta_property.rb
Instance Attribute Summary collapse
-
#meta_properties ⇒ Object
Returns the value of attribute meta_properties.
-
#meta_type_property ⇒ Object
Returns the value of attribute meta_type_property.
-
#sid ⇒ Object
Returns the value of attribute sid.
Instance Method Summary collapse
- #choices ⇒ Object
-
#initialize(meta_properties, sid) ⇒ MetaProperty
constructor
A new instance of MetaProperty.
- #value ⇒ Object
- #value=(val) ⇒ Object
Constructor Details
#initialize(meta_properties, sid) ⇒ MetaProperty
Returns a new instance of MetaProperty.
6 7 8 9 10 |
# File 'lib/meta_types/meta_property.rb', line 6 def initialize(, sid) self. = self.sid = sid self. = MetaTypeProperty[sid] end |
Instance Attribute Details
#meta_properties ⇒ Object
Returns the value of attribute meta_properties.
2 3 4 |
# File 'lib/meta_types/meta_property.rb', line 2 def @meta_properties end |
#meta_type_property ⇒ Object
Returns the value of attribute meta_type_property.
3 4 5 |
# File 'lib/meta_types/meta_property.rb', line 3 def @meta_type_property end |
#sid ⇒ Object
Returns the value of attribute sid.
4 5 6 |
# File 'lib/meta_types/meta_property.rb', line 4 def sid @sid end |
Instance Method Details
#choices ⇒ Object
20 21 22 23 |
# File 'lib/meta_types/meta_property.rb', line 20 def choices() ch = .choices.presence ch && ch.split('||').map(&:strip) end |
#value ⇒ Object
12 13 14 |
# File 'lib/meta_types/meta_property.rb', line 12 def value .cast(.try(:get_value, sid) || .default_value) end |
#value=(val) ⇒ Object
16 17 18 |
# File 'lib/meta_types/meta_property.rb', line 16 def value=(val) .set_value(sid, .parse(val)) end |