Parent

Methods

Hash

Extension to Hash to create URL encoded string from key-values

Public Instance Methods

to_http_str() click to toggle source

Returns string formatted for HTTP URL encoded name-value pairs. For example,

{:id => 'thomas_hardy'}.to_http_str 
# => "id=thomas_hardy"
{:id => 23423, :since => Time.now}.to_http_str
# => "since=Thu,%2021%20Jun%202007%2012:10:05%20-0500&id=23423"
# File lib/twitter/ext/stdlib.rb, line 11
def to_http_str
  result = ''
  return result if self.empty?
  self.each do |key, val|
    result << "#{key}=#{CGI.escape(val.to_s)}&"
  end
  result.chop # remove the last '&' character, since it can be discarded
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.