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.
161 162 163 |
# File 'lib/stratagem/model/components/view.rb', line 161 def initialize(model) @fields = [] end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
159 160 161 |
# File 'lib/stratagem/model/components/view.rb', line 159 def fields @fields end |
Instance Method Details
#add_field(name, type) ⇒ Object
165 166 167 |
# File 'lib/stratagem/model/components/view.rb', line 165 def add_field(name, type) @fields << FormField.new(name, type) end |
#export ⇒ Object
169 170 171 |
# File 'lib/stratagem/model/components/view.rb', line 169 def export {:model => @model, :fields => @fields.map {|f| f.export } } end |