Class: Rbkb::Http::FormUrlencodedParams

Inherits:
Parameters show all
Defined in:
lib/rbkb/http/parameters.rb

Overview

The FormUrlencodedParams class is for Parameters values in the form of ‘q=foo&l=1&z=baz’ as found in GET query strings and application/www-form-urlencoded or application/x-url-encoded POST contents.

Instance Method Summary collapse

Methods inherited from Parameters

#delete_param, #get_all, #get_all_values_for, #get_param, #get_value_for, #initialize, parse, #set_all_for, #set_param

Methods included from CommonInterface

#_common_init, #opts, #opts=

Methods inherited from Array

#rand_elem, #randomize

Constructor Details

This class inherits a constructor from Rbkb::Http::Parameters

Instance Method Details

#capture(str) ⇒ Object



76
77
78
79
80
81
82
83
# File 'lib/rbkb/http/parameters.rb', line 76

def capture(str)
  raise "arg 0 must be a string" unless String === str
  str.split('&').each do |p| 
    var,val = p.split('=',2)
    self << [var,val]
  end
  return self
end

#to_rawObject



72
73
74
# File 'lib/rbkb/http/parameters.rb', line 72

def to_raw
  self.map {|k,v| "#{k}=#{v}"}.join('&')
end