Class: Bitly4R::Params
- Inherits:
-
Hash
- Object
- Hash
- Bitly4R::Params
- 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
-
#to_s ⇒ Object
An encoded composite of the parameters, ready for use in a URL.
Instance Method Details
#to_s ⇒ Object
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 |