Sha256: e394b82de90a88e0bac4c5b91a4e6e08de74ce2313cd91b166ea0df6eb948bc5

Contents?: true

Size: 361 Bytes

Versions: 5

Compression:

Stored size: 361 Bytes

Contents

class Hash
  def to_url_params
    elements = []
    keys.size.times do |i|
      elements << "#{keys[i]}=#{values[i]}"
    end
    elements.join('&')
  end

  def self.from_url_params(url_params="")
    result = {}
    url_params.split('&').each do |element|
      element = element.split('=')
      result[element[0]] = element[1]
    end
    result
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
githu3-0.0.8 lib/githu3/core_ext/hash.rb
githu3-0.0.7 lib/githu3/core_ext/hash.rb
githu3-0.0.6 lib/githu3/core_ext/hash.rb
githu3-0.0.5 lib/githu3/core_ext/hash.rb
githu3-0.0.4 lib/githu3/core_ext/hash.rb