Class: OpenapiContracts::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_contracts/match.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc, response, options = {}) ⇒ Match

Returns a new instance of Match.



5
6
7
8
9
# File 'lib/openapi_contracts/match.rb', line 5

def initialize(doc, response, options = {})
  @doc = doc
  @response = response
  @options = options
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



3
4
5
# File 'lib/openapi_contracts/match.rb', line 3

def errors
  @errors
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
# File 'lib/openapi_contracts/match.rb', line 11

def valid?
  return @errors.empty? if instance_variable_defined?(:@errors)

  @errors = matchers.call
  @errors.empty?
end