Class: JsonldValidate::Validator
- Inherits:
-
Object
- Object
- JsonldValidate::Validator
- Defined in:
- lib/jsonld_validate/validator.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#errors ⇒ Object
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(content) ⇒ Validator
constructor
A new instance of Validator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(content) ⇒ Validator
Returns a new instance of Validator.
7 8 9 10 |
# File 'lib/jsonld_validate/validator.rb', line 7 def initialize(content) @content = content @errors = [] end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
5 6 7 |
# File 'lib/jsonld_validate/validator.rb', line 5 def content @content end |
#errors ⇒ Object
Returns the value of attribute errors.
5 6 7 |
# File 'lib/jsonld_validate/validator.rb', line 5 def errors @errors end |
Instance Method Details
#valid? ⇒ Boolean
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/jsonld_validate/validator.rb', line 12 def valid? return false if content.nil? return true if content.empty? build_doc return false unless errors.empty? find_unknown_fields(content, doc, []) errors.empty? end |