Module: Gattica::HashExtensions
- Defined in:
- lib/gattica/hash_extensions.rb
Instance Method Summary collapse
Instance Method Details
#key ⇒ Object
11 12 13 |
# File 'lib/gattica/hash_extensions.rb', line 11 def key self.keys.first if self.length == 1 end |
#to_query ⇒ Object
4 5 6 7 8 9 |
# File 'lib/gattica/hash_extensions.rb', line 4 def to_query require 'cgi' unless defined?(CGI) && defined?(CGI::escape) self.collect do |key, value| "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}" end.sort * '&' end |
#value ⇒ Object
15 16 17 |
# File 'lib/gattica/hash_extensions.rb', line 15 def value self.values.first if self.length == 1 end |