Class: Stratagem::Model::Component::Form
- Defined in:
- lib/stratagem/model/components/view.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Instance Method Summary collapse
- #add_field(name, type) ⇒ Object
- #export ⇒ Object
-
#initialize(model) ⇒ Form
constructor
A new instance of Form.
Constructor Details
#initialize(model) ⇒ Form
Returns a new instance of Form.
160 161 162 |
# File 'lib/stratagem/model/components/view.rb', line 160 def initialize(model) @fields = [] end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
158 159 160 |
# File 'lib/stratagem/model/components/view.rb', line 158 def fields @fields end |
Instance Method Details
#add_field(name, type) ⇒ Object
164 165 166 |
# File 'lib/stratagem/model/components/view.rb', line 164 def add_field(name, type) @fields << FormField.new(name, type) end |
#export ⇒ Object
168 169 170 |
# File 'lib/stratagem/model/components/view.rb', line 168 def export {:model => @model, :fields => @fields.map {|f| f.export } } end |