Class: PnoteClient::Validators::PnoteValidator
- Inherits:
-
Object
- Object
- PnoteClient::Validators::PnoteValidator
- Defined in:
- lib/pnote_client/validators/pnote_validator.rb
Instance Method Summary collapse
- #error_count ⇒ Object
- #has_error? ⇒ Boolean
- #has_warning? ⇒ Boolean
-
#initialize(pnote_document, display = nil) ⇒ PnoteValidator
constructor
A new instance of PnoteValidator.
- #validate ⇒ Object
- #warning_count ⇒ Object
Constructor Details
#initialize(pnote_document, display = nil) ⇒ PnoteValidator
Returns a new instance of PnoteValidator.
9 10 11 12 13 14 15 16 |
# File 'lib/pnote_client/validators/pnote_validator.rb', line 9 def initialize(pnote_document, display = nil) @pnote_document = pnote_document @display = display @result = { errors: [], warnings: [] } end |
Instance Method Details
#error_count ⇒ Object
33 34 35 |
# File 'lib/pnote_client/validators/pnote_validator.rb', line 33 def error_count return @result[:errors].length end |
#has_error? ⇒ Boolean
25 26 27 |
# File 'lib/pnote_client/validators/pnote_validator.rb', line 25 def has_error? return error_count > 0 end |
#has_warning? ⇒ Boolean
29 30 31 |
# File 'lib/pnote_client/validators/pnote_validator.rb', line 29 def has_warning? return warning_count > 0 end |
#validate ⇒ Object
18 19 20 21 22 23 |
# File 'lib/pnote_client/validators/pnote_validator.rb', line 18 def validate reset_result validate_pnote_document print_validation_result return @result end |
#warning_count ⇒ Object
37 38 39 |
# File 'lib/pnote_client/validators/pnote_validator.rb', line 37 def warning_count return @result[:warnings].length end |