Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/wikibot/ext/hash.rb

Direct Known Subclasses

OpenHash

Instance Method Summary collapse

Instance Method Details

#to_openhashObject



18
19
20
# File 'lib/wikibot/ext/hash.rb', line 18

def to_openhash
  OpenHash.new(self)
end

#to_post_fieldsObject



4
5
6
7
8
9
# File 'lib/wikibot/ext/hash.rb', line 4

def to_post_fields
  inject([]) do |memo, pair|
    key, val = pair
    memo.push Curl::PostField.content(key.to_s, val.to_s)
  end
end

#to_querystringObject



11
12
13
14
15
16
# File 'lib/wikibot/ext/hash.rb', line 11

def to_querystring
  inject([]) do |memo, pair|
    key, val = pair
    memo.push "#{CGI::escape(key.to_s)}=#{CGI::escape(val.to_s)}"
  end.join("&")
end