Class: Campo::Form
Constant Summary collapse
- DEFAULT =
{ method: "POST" }
Instance Attribute Summary
Attributes inherited from Base
Attributes included from Childish
Instance Method Summary collapse
-
#initialize(name, attributes = {}) ⇒ Form
constructor
A new instance of Form.
Methods inherited from Base
#labelled, #on_output, #output, output, quotable, unhash
Methods included from Convenience
#bit_of_ruby, #checkbox, #fieldset, #input, #literal, #radio, #select, #submit, #text, #textarea
Methods included from Iding
Methods included from Childish
Constructor Details
#initialize(name, attributes = {}) ⇒ Form
Returns a new instance of Form.
280 281 282 283 284 285 286 287 288 |
# File 'lib/campo.rb', line 280 def initialize(name, attributes={} ) attributes[:id] = name.gsub(/\W/, "_") if attributes[:id].nil? super( name, DEFAULT.merge( attributes ) ) self.on_output do |n=0, tab=2| %Q!#{" " * n * tab}%form{ atts[:#{name.gsub(/\W/, "_").downcase}], #{Base.unhash( @attributes )} }! end self end |