Class: HtmlCom::Form
Instance Method Summary collapse
- #add_submit ⇒ Object
-
#initialize(inputs = nil, id: nil, method: :get, action: '') ⇒ Form
constructor
A new instance of Form.
Methods inherited from Element
#html_element, #to_doc, #to_html
Constructor Details
#initialize(inputs = nil, id: nil, method: :get, action: '') ⇒ Form
Returns a new instance of Form.
467 468 469 470 471 472 473 474 475 476 477 478 479 |
# File 'lib/htmlcom.rb', line 467 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 |
Instance Method Details
#add_submit ⇒ Object
481 482 483 484 |
# File 'lib/htmlcom.rb', line 481 def add_submit() submit = Rexle.new(['input', {type: 'submit', value: 'Submit'}]) html_element().add submit end |