Class: Bolt::Validator
- Inherits:
-
Object
- Object
- Bolt::Validator
- Defined in:
- lib/bolt/validator.rb
Instance Attribute Summary collapse
-
#deprecations ⇒ Object
readonly
Returns the value of attribute deprecations.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize ⇒ Validator
constructor
A new instance of Validator.
-
#validate(data, schema, location = nil) ⇒ Object
This is the entry method for validating data against the schema.
Constructor Details
#initialize ⇒ Validator
Returns a new instance of Validator.
12 13 14 15 16 17 |
# File 'lib/bolt/validator.rb', line 12 def initialize @errors = [] @deprecations = [] @warnings = [] @path = [] end |
Instance Attribute Details
#deprecations ⇒ Object (readonly)
Returns the value of attribute deprecations.
10 11 12 |
# File 'lib/bolt/validator.rb', line 10 def deprecations @deprecations end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
10 11 12 |
# File 'lib/bolt/validator.rb', line 10 def warnings @warnings end |
Instance Method Details
#validate(data, schema, location = nil) ⇒ Object
This is the entry method for validating data against the schema.
21 22 23 24 25 26 27 28 |
# File 'lib/bolt/validator.rb', line 21 def validate(data, schema, location = nil) @schema = schema @location = location validate_value(data, schema) raise_error end |