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, message = nil) ⇒ BaseDifference

Returns a new instance of BaseDifference.



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

def initialize expected, actual, message = nil
  @expected = expected
  @actual = actual
  @message = message
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

#messageObject

Returns the value of attribute message.



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

def message
  @message
end

Instance Method Details

#==(other) ⇒ Object



33
34
35
# File 'lib/pact/matchers/base_difference.rb', line 33

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

#any?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/pact/matchers/base_difference.rb', line 17

def any?
  true
end

#empty?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/pact/matchers/base_difference.rb', line 21

def empty?
  false
end

#to_json(options = {}) ⇒ Object



25
26
27
# File 'lib/pact/matchers/base_difference.rb', line 25

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

#to_sObject



29
30
31
# File 'lib/pact/matchers/base_difference.rb', line 29

def to_s
  as_json.to_s
end