Class: Bitly4R::Params

Inherits:
Hash
  • Object
show all
Defined in:
lib/bitly4r/objects.rb

Overview

Params

Extends the Hash class to provide simply composition of a URL-encoded string.

Could have extended Hash, but chose instead to ‘leave no trace’.

Instance Method Summary collapse

Instance Method Details

#to_sObject

An encoded composite of the parameters, ready for use in a URL



43
44
45
46
47
# File 'lib/bitly4r/objects.rb', line 43

def to_s
	(self.to_a.collect do |k, v|
		"#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"
	end).join('&')
end