Class: WWMD::Form
- Inherits:
-
Object
- Object
- WWMD::Form
- Defined in:
- lib/wwmd/page/form.rb,
lib/wwmd/page/irb_helpers.rb
Overview
original author of hpricot_form
Chew Choon Keat <choonkeat at gmail>
http://blog.yanime.org/
19 July 2006
updated by mtracy at matasano.com for use with Nokogiri and WWMD
Direct Known Subclasses
Instance Attribute Summary collapse
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#formtag ⇒ Object
Returns the value of attribute formtag.
-
#hdoc ⇒ Object
Returns the value of attribute hdoc.
Instance Method Summary collapse
- #action ⇒ Object
- #field_names ⇒ Object
-
#initialize(doc) ⇒ Form
constructor
A new instance of Form.
- #method_missing(*args) ⇒ Object
-
#old_fields ⇒ Object
Returns the value of attribute fields.
- #report ⇒ Object (also: #show)
- #type ⇒ Object
Constructor Details
#initialize(doc) ⇒ Form
Returns a new instance of Form.
17 18 19 20 |
# File 'lib/wwmd/page/form.rb', line 17 def initialize(doc) @hdoc = doc @formtag = @hdoc.search("//form") end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
22 23 24 |
# File 'lib/wwmd/page/form.rb', line 22 def method_missing(*args) hdoc.send(*args) end |
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields.
14 15 16 |
# File 'lib/wwmd/page/form.rb', line 14 def fields @fields end |
#formtag ⇒ Object
Returns the value of attribute formtag.
15 16 17 |
# File 'lib/wwmd/page/form.rb', line 15 def formtag @formtag end |
#hdoc ⇒ Object
Returns the value of attribute hdoc.
13 14 15 |
# File 'lib/wwmd/page/form.rb', line 13 def hdoc @hdoc end |
Instance Method Details
#action ⇒ Object
39 40 41 |
# File 'lib/wwmd/page/form.rb', line 39 def action return self.get_attribute("action") end |
#field_names ⇒ Object
35 36 37 |
# File 'lib/wwmd/page/form.rb', line 35 def field_names fields.map { |x| x.get_attribute("name") } end |
#old_fields ⇒ Object
Returns the value of attribute fields.
26 27 28 |
# File 'lib/wwmd/page/form.rb', line 26 def fields @fields end |
#report ⇒ Object Also known as: show
92 93 94 95 96 97 |
# File 'lib/wwmd/page/irb_helpers.rb', line 92 def report return nil if not WWMD::console puts "action = #{self.action}" self.fields.each { |field| puts field.to_text } return nil end |
#type ⇒ Object
43 44 45 |
# File 'lib/wwmd/page/form.rb', line 43 def type return self.get_attribute("method") end |