Class: Maze::Schemas::ConfigValidator
- Inherits:
-
ValidatorBase
- Object
- ValidatorBase
- Maze::Schemas::ConfigValidator
- Defined in:
- lib/maze/schemas/config_validator.rb
Constant Summary
Constants inherited from ValidatorBase
ValidatorBase::HEX_STRING_16, ValidatorBase::HEX_STRING_32, ValidatorBase::HOUR_TOLERANCE
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#success ⇒ Object
Returns the value of attribute success.
Instance Method Summary collapse
-
#initialize(request, validation_block) ⇒ ConfigValidator
constructor
A new instance of ConfigValidator.
- #validate ⇒ Object
Methods inherited from ValidatorBase
#each_element_contains, #each_element_contains_each, #each_element_exists, #each_event_contains, #each_event_contains_each, #element_a_greater_or_equal_element_b, #element_exists, #element_has_value, #element_int_in_range, #regex_comparison, #validate_header, #validate_timestamp
Constructor Details
#initialize(request, validation_block) ⇒ ConfigValidator
Returns a new instance of ConfigValidator.
15 16 17 18 |
# File 'lib/maze/schemas/config_validator.rb', line 15 def initialize(request, validation_block) super(request) @validation_block = validation_block end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
13 14 15 |
# File 'lib/maze/schemas/config_validator.rb', line 13 def body @body end |
#errors ⇒ Object
Returns the value of attribute errors.
11 12 13 |
# File 'lib/maze/schemas/config_validator.rb', line 11 def errors @errors end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
12 13 14 |
# File 'lib/maze/schemas/config_validator.rb', line 12 def headers @headers end |
#success ⇒ Object
Returns the value of attribute success.
10 11 12 |
# File 'lib/maze/schemas/config_validator.rb', line 10 def success @success end |
Instance Method Details
#validate ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/maze/schemas/config_validator.rb', line 20 def validate @success = true @validation_block.call(self) rescue => exception @success = false @errors << "A #{exception.class} occurred while running validation: #{exception.}, \n #{exception.backtrace.join("\n")}" end |