Class: Recliner::Property
- Defined in:
- lib/recliner/properties/property.rb
Instance Attribute Summary collapse
-
#as ⇒ Object
Returns the value of attribute as.
-
#default ⇒ Object
Returns the value of attribute default.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#as ⇒ Object
Returns the value of attribute as
5 6 7 |
# File 'lib/recliner/properties/property.rb', line 5 def as @as end |
#default ⇒ Object
Returns the value of attribute default
5 6 7 |
# File 'lib/recliner/properties/property.rb', line 5 def default @default end |
#name ⇒ Object
Returns the value of attribute name
5 6 7 |
# File 'lib/recliner/properties/property.rb', line 5 def name @name end |
#type ⇒ Object
Returns the value of attribute type
5 6 7 |
# File 'lib/recliner/properties/property.rb', line 5 def type @type end |
Instance Method Details
#default_value(instance) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/recliner/properties/property.rb', line 6 def default_value(instance) if default.respond_to?(:call) default.arity == 1 ? default.call(instance) : default.call else default.duplicable? ? default.dup : default end end |
#type_cast(value) ⇒ Object
14 15 16 |
# File 'lib/recliner/properties/property.rb', line 14 def type_cast(value) Conversions.convert(value, type) end |