Class: SimpleFormObject::Attribute
- Inherits:
-
Object
- Object
- SimpleFormObject::Attribute
- Defined in:
- lib/simple_form_object.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #apply_default_to(form) ⇒ Object
- #fake_column ⇒ Object
-
#initialize(name, type, options) ⇒ Attribute
constructor
A new instance of Attribute.
Constructor Details
#initialize(name, type, options) ⇒ Attribute
Returns a new instance of Attribute.
42 43 44 45 46 47 48 |
# File 'lib/simple_form_object.rb', line 42 def initialize(name, type, ) @name = name @type = type = end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
50 51 52 |
# File 'lib/simple_form_object.rb', line 50 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
50 51 52 |
# File 'lib/simple_form_object.rb', line 50 def end |
#type ⇒ Object
Returns the value of attribute type.
50 51 52 |
# File 'lib/simple_form_object.rb', line 50 def type @type end |
Instance Method Details
#apply_default_to(form) ⇒ Object
56 57 58 59 60 |
# File 'lib/simple_form_object.rb', line 56 def apply_default_to(form) if form.send(@name).nil? form.send("#{@name}=", @default) if @default end end |
#fake_column ⇒ Object
52 53 54 |
# File 'lib/simple_form_object.rb', line 52 def fake_column self end |