Class: Openapi3Parser::Validation::InputValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi3_parser/validation/input_validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(callable) ⇒ InputValidator

Returns a new instance of InputValidator.



8
9
10
# File 'lib/openapi3_parser/validation/input_validator.rb', line 8

def initialize(callable)
  @callable = callable
end

Instance Attribute Details

#callableObject (readonly)

Returns the value of attribute callable.



6
7
8
# File 'lib/openapi3_parser/validation/input_validator.rb', line 6

def callable
  @callable
end

Instance Method Details

#call(validatable) ⇒ Object



12
13
14
15
# File 'lib/openapi3_parser/validation/input_validator.rb', line 12

def call(validatable)
  error = callable.call(validatable.input)
  validatable.add_error(error) if error
end