Class: Pact::QueryString

Inherits:
Object
  • Object
show all
Includes:
ActiveSupportSupport, Matchers
Defined in:
lib/pact/consumer_contract/query_string.rb

Constant Summary

Constants included from Matchers

Matchers::DEFAULT_OPTIONS, Matchers::NO_DIFF, Matchers::NO_DIFF_AT_INDEX

Instance Method Summary collapse

Methods included from Matchers

#diff, #type_diff

Methods included from ActiveSupportSupport

#fix_all_the_things, #fix_json_formatting, #fix_regexp, #remove_unicode

Constructor Details

#initialize(query) ⇒ QueryString

Returns a new instance of QueryString.



10
11
12
# File 'lib/pact/consumer_contract/query_string.rb', line 10

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

Instance Method Details

#==(other) ⇒ Object



26
27
28
# File 'lib/pact/consumer_contract/query_string.rb', line 26

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

#as_json(opts = {}) ⇒ Object



14
15
16
# File 'lib/pact/consumer_contract/query_string.rb', line 14

def as_json opts = {}
  @query
end

#difference(other) ⇒ Object



30
31
32
# File 'lib/pact/consumer_contract/query_string.rb', line 30

def difference(other)
  diff(query, other.query)
end

#empty?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/pact/consumer_contract/query_string.rb', line 42

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/pact/consumer_contract/query_string.rb', line 22

def eql? other
  self == other
end

#nil?Boolean

Naughty…

Returns:

  • (Boolean)


47
48
49
# File 'lib/pact/consumer_contract/query_string.rb', line 47

def nil?
  @query.nil?
end

#queryObject



34
35
36
# File 'lib/pact/consumer_contract/query_string.rb', line 34

def query
  @query
end

#to_json(opts = {}) ⇒ Object



18
19
20
# File 'lib/pact/consumer_contract/query_string.rb', line 18

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

#to_sObject



38
39
40
# File 'lib/pact/consumer_contract/query_string.rb', line 38

def to_s
  @query
end