Class: Watobo::HTTP::Url
- Inherits:
-
Object
- Object
- Watobo::HTTP::Url
- Defined in:
- lib/watobo/http/url/url.rb
Instance Method Summary collapse
- #has_parm?(parm_name) ⇒ Boolean
-
#initialize(root) ⇒ Url
constructor
A new instance of Url.
- #parameters(&block) ⇒ Object
- #set(parm) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Method Details
#has_parm?(parm_name) ⇒ Boolean
39 40 41 42 43 44 |
# File 'lib/watobo/http/url/url.rb', line 39 def has_parm?(parm_name) @root.get_parm_names do |pn| return true if pn == parm_name end false end |
#parameters(&block) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/watobo/http/url/url.rb', line 46 def parameters(&block) parms = [] @root.get_parms.each do |p| name, val = p.split("=") parms << Watobo::UrlParameter.new( :name => name, :value => val ) end parms end |
#set(parm) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/watobo/http/url/url.rb', line 31 def set(parm) if has_parm?(parm.name) @root.replace_get_parm(parm.name, parm.value) else @root.add_get_parm(parm.name, parm.value) end end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/watobo/http/url/url.rb', line 26 def to_s s = @root.url_string end |