Sha256: c9a80c9b1dc254e57de396329735cbf8c3c69607e504fb10ea69a1c81045dc6e

Contents?: true

Size: 497 Bytes

Versions: 1

Compression:

Stored size: 497 Bytes

Contents

module PGit
  module Pivotal
    class Request
      class Query
        def initialize(args={})
          @args = args
        end

        def to_s
          query_with_extra_ampersand[0...query_with_extra_ampersand.length-1]
        end

        private

        def query_with_extra_ampersand
          hash_strings.inject("?") { |accum, item| accum + item }
        end

        def hash_strings
          @args.map { |key, value| "#{key}=#{value}&" }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pgit-1.0.0 lib/pgit/pivotal/request/query.rb