Sha256: 8a09f3b462b04f70d5efa7a81dc3084eaf70f0779fa17466ca2c43c3a9a1104a

Contents?: true

Size: 824 Bytes

Versions: 1

Compression:

Stored size: 824 Bytes

Contents

require 'pact/shared/active_support_support'

module Pact
  class QueryString

    include ActiveSupportSupport
    include Pact::Matchers

    def initialize query
      @query = query.nil? ? query : query.dup
    end

    def as_json opts = {}
      @query
    end

    def to_json opts = {}
      as_json(opts).to_json(opts)
    end

    def eql? other
      self == other
    end

    def == other
      QueryString === other && other.query == query
    end

    def difference(other)
      require 'pact/matchers' # avoid recursive loop between this file and pact/matchers
      Pact::Matchers.diff(query, other.query)
    end

    def query
      @query
    end

    def to_s
      @query
    end

    def empty?
      @query && @query.empty?
    end

    # Naughty...
    def nil?
      @query.nil?
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pact-support-1.5.1 lib/pact/consumer_contract/query_string.rb