Class: Watobo::HTTPData::WWW_Form
- Defined in:
- lib/watobo/http/data/data.rb
Instance Method Summary collapse
- #has_parm?(parm_name) ⇒ Boolean
-
#initialize(root) ⇒ WWW_Form
constructor
A new instance of WWW_Form.
- #parameters(&block) ⇒ Object
- #set(parm) ⇒ Object
Methods inherited from Base
Constructor Details
Instance Method Details
#has_parm?(parm_name) ⇒ Boolean
44 45 46 47 48 49 |
# File 'lib/watobo/http/data/data.rb', line 44 def has_parm?(parm_name) @root.post_parm_names do |pn| return true if pn == parm_name end false end |
#parameters(&block) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/watobo/http/data/data.rb', line 51 def parameters(&block) parms = [] @root.post_parms.each do |p| name, val = p.split("=") parms << Watobo::WWWFormParameter.new( :name => name, :value => val ) end parms end |
#set(parm) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/watobo/http/data/data.rb', line 36 def set(parm) if has_parm?(parm.name) @root.replace_post_parm(parm.name, parm.value) else @root.add_post_parm(parm.name, parm.value) end end |