Class: SimpleRecord::Attributes::Attribute
- Inherits:
-
Object
- Object
- SimpleRecord::Attributes::Attribute
- Defined in:
- lib/simple_record/attributes.rb
Overview
Holds information about an attribute
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #init_value(value) ⇒ Object
-
#initialize(type, options = nil) ⇒ Attribute
constructor
A new instance of Attribute.
Constructor Details
#initialize(type, options = nil) ⇒ Attribute
Returns a new instance of Attribute.
209 210 211 212 |
# File 'lib/simple_record/attributes.rb', line 209 def initialize(type, =nil) @type = type = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
207 208 209 |
# File 'lib/simple_record/attributes.rb', line 207 def end |
#type ⇒ Object
Returns the value of attribute type.
207 208 209 |
# File 'lib/simple_record/attributes.rb', line 207 def type @type end |
Instance Method Details
#init_value(value) ⇒ Object
214 215 216 217 218 219 220 221 222 |
# File 'lib/simple_record/attributes.rb', line 214 def init_value(value) return value if value.nil? ret = value case self.type when :int ret = value.to_i end ret end |