Class: HtmlCom::Form
Instance Method Summary collapse
-
#initialize(inputs = nil, id: nil, method: :get, action: '') ⇒ Form
constructor
A new instance of Form.
Methods inherited from Element
#build, #html_element, #to_doc
Constructor Details
#initialize(inputs = nil, id: nil, method: :get, action: '') ⇒ Form
432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/htmlcom.rb', line 432 def initialize(inputs=nil, id: nil, method: :get, action: '') @tag = 'form' @htmltag = 'form' @id = id super([:root, {}, [@tag,{}, [@htmltag, {}]]]) form = @doc.root.element(@tag + '/' + @htmltag) form.add inputs if inputs form.attributes[:method] = method.to_s form.attributes[:action] = action end |