Class: Stratagem::Model::Component::Form

Inherits:
Object
  • Object
show all
Defined in:
lib/stratagem/model/components/view.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fieldsObject (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

#exportObject



168
169
170
# File 'lib/stratagem/model/components/view.rb', line 168

def export
  {:model => @model, :fields => @fields.map {|f| f.export } }
end