Sha256: 0f54aabbae0661912b3ca981957f315cc6a20ec76e3c48720ee54c31bf091b67

Contents?: true

Size: 541 Bytes

Versions: 6

Compression:

Stored size: 541 Bytes

Contents

class Hash
	def to_q_param_string
		self.inject([]){|r,(k,v)| r.push( "#{k}=#{v}" )}.join("&")
	end

	def to_cookie_string
		self.inject([]){|r,(k,v)| r.push( "#{k}=#{v}" )}.join("; ") + ";"
	end
end

class String
	def to_q_param_hash
		self.split("&").inject({}) do |hash, key_value|
			key, value = key_value.split("=")
			hash[key.to_sym] = value
			hash
		end
	end
	def to_cookies_hash
		tmp = self[0..-2]
		tmp.split("; ").inject({}) do |hash, key_value|
			key, value = key_value.split("=")
			hash[key] = value
			hash
		end
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rquest-2.0 lib/rquest/core_overrides.rb
rquest-1.0.4 lib/rquest/core_overrides.rb
rquest-1.0.3 lib/rquest/core_overrides.rb
rquest-1.0.2 lib/rquest/core_overrides.rb
rquest-1.0.1 lib/rquest/core_overrides.rb
rquest-1.0.0 lib/rquest/core_overrides.rb