Sha256: 549dd8badea7fc155fbc745e2c3dba0c9c0b7111dd29930910870d17f30f72c4

Contents?: true

Size: 606 Bytes

Versions: 15

Compression:

Stored size: 606 Bytes

Contents

#
# helpers.rb
# Crowdskout
#
# Copyright (c) 2016 Kyle Schutt. All rights reserved.

module Crowdskout
  module Util
    class Helpers
      class << self

        # Build the HTTP query from the given parameters
        # @param [Hash] params
        # @return [String] query string
        def http_build_query(params)
          params.collect{ |k,v| "#{k.to_s}=#{encode(v.to_s)}" }.reverse.join('&')
        end

        # Escape special characters
        # @param [String] str
        def encode(str)
          CGI.escape(str).gsub('.', '%2E').gsub('-', '%2D')
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
crowdskout-0.1.5 lib/crowdskout/util/helpers.rb
crowdskout-0.1.4 lib/crowdskout/util/helpers.rb
crowdskout-0.1.3 lib/crowdskout/util/helpers.rb
crowdskout-0.1.2 lib/crowdskout/util/helpers.rb
crowdskout-0.1.1 lib/crowdskout/util/helpers.rb
crowdskout-0.1.0 lib/crowdskout/util/helpers.rb
crowdskout-0.0.20 lib/crowdskout/util/helpers.rb
crowdskout-0.0.19 lib/crowdskout/util/helpers.rb
crowdskout-0.0.13 lib/crowdskout/util/helpers.rb
crowdskout-0.0.10 lib/crowdskout/util/helpers.rb
crowdskout-0.0.9 lib/crowdskout/util/helpers.rb
crowdskout-0.0.8 lib/crowdskout/util/helpers.rb
crowdskout-0.0.7 lib/crowdskout/util/helpers.rb
crowdskout-0.0.6 lib/crowdskout/util/helpers.rb
crowdskout-0.0.5 lib/crowdskout/util/helpers.rb