Sha256: 1dc1be935b2611ee3ebdb7e74e35045ab7ba5479e580f6dffee81d2984977f79

Contents?: true

Size: 463 Bytes

Versions: 1

Compression:

Stored size: 463 Bytes

Contents

module IronMotion
  module Helper
    def Helper.hash_to_query_string(hash)
      query_string = ''
      if hash.keys == 0
        return ""
      elsif hash.keys == 1
        hash.each_pair do |k,v|
          query_string << "#{k}=#{v}"
        end
      else
        hash.each_pair do |k,v|
          query_string << "#{k}=#{v}&"
        end
      end

      query_string.chomp!('&')
      query_string.chomp!('.0')
      "?#{query_string}"
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iron-motion-0.0.1 motion/helper.rb