Class: JsonValidation::Validators::Ref
- Defined in:
- lib/json_validation/validators/ref.rb
Instance Attribute Summary
Attributes inherited from Validator
Instance Method Summary collapse
Methods inherited from Validator
#build_validator, #build_validator_with_new_base_uri, #initialize, type
Constructor Details
This class inherits a constructor from JsonValidation::Validators::Validator
Instance Method Details
#inner_validator ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/json_validation/validators/ref.rb', line 10 def inner_validator return @inner_validator if @inner_validator path = fragment['$ref'] reffed_uri = base_uri.join(Addressable::URI.parse(path)) reffed_schema = JsonValidation.load_schema(reffed_uri) @inner_validator = build_validator_with_new_base_uri(reffed_schema, reffed_uri) end |
#validate(record) ⇒ Object
6 7 8 |
# File 'lib/json_validation/validators/ref.rb', line 6 def validate(record) inner_validator.validate(record) end |