Class: Pact::Matchers::BaseDifference

Inherits:
Object
  • Object
show all
Defined in:
lib/pact/matchers/base_difference.rb

Direct Known Subclasses

Difference, RegexpDifference, TypeDifference

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected, actual) ⇒ BaseDifference

Returns a new instance of BaseDifference.



10
11
12
13
# File 'lib/pact/matchers/base_difference.rb', line 10

def initialize expected, actual
  @expected = expected
  @actual = actual
end

Instance Attribute Details

#actualObject (readonly)

Returns the value of attribute actual.



8
9
10
# File 'lib/pact/matchers/base_difference.rb', line 8

def actual
  @actual
end

#expectedObject (readonly)

Returns the value of attribute expected.



8
9
10
# File 'lib/pact/matchers/base_difference.rb', line 8

def expected
  @expected
end

Instance Method Details

#==(other) ⇒ Object



31
32
33
# File 'lib/pact/matchers/base_difference.rb', line 31

def == other
  other.class == self.class && other.expected == expected && other.actual == actual
end

#any?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/pact/matchers/base_difference.rb', line 15

def any?
  true
end

#empty?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/pact/matchers/base_difference.rb', line 19

def empty?
  false
end

#to_json(options = {}) ⇒ Object



23
24
25
# File 'lib/pact/matchers/base_difference.rb', line 23

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

#to_sObject



27
28
29
# File 'lib/pact/matchers/base_difference.rb', line 27

def to_s
  as_json.to_s
end