Class: Pact::ExpectedType

Inherits:
DifferenceIndicator show all
Defined in:
lib/pact/matchers/expected_type.rb

Direct Known Subclasses

ActualType

Instance Method Summary collapse

Methods inherited from DifferenceIndicator

#eql?

Methods included from ActiveSupportSupport

#fix_all_the_things, #fix_json_formatting, #fix_regexp, #remove_unicode

Constructor Details

#initialize(value) ⇒ ExpectedType

Returns a new instance of ExpectedType.



6
7
8
# File 'lib/pact/matchers/expected_type.rb', line 6

def initialize value
  @value = value
end

Instance Method Details

#==(other) ⇒ Object



26
27
28
# File 'lib/pact/matchers/expected_type.rb', line 26

def == other
  eq? other
end

#as_json(options = {}) ⇒ Object



18
19
20
# File 'lib/pact/matchers/expected_type.rb', line 18

def as_json options = {}
  type
end

#eq?(other) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/pact/matchers/expected_type.rb', line 22

def eq? other
  self.class == other.class && other.type == type
end

#to_json(options = {}) ⇒ Object



14
15
16
# File 'lib/pact/matchers/expected_type.rb', line 14

def to_json options = {}
  type
end

#to_sObject



30
31
32
# File 'lib/pact/matchers/expected_type.rb', line 30

def to_s
  type
end

#typeObject



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

def type
  @value.class.name
end