Class: Metaschema::ConstraintValidator::ConstraintError
- Inherits:
-
Object
- Object
- Metaschema::ConstraintValidator::ConstraintError
- Defined in:
- lib/metaschema/constraint_validator.rb
Overview
Simple wrapper for constraint error info
Instance Attribute Summary collapse
-
#constraint_type ⇒ Object
readonly
Returns the value of attribute constraint_type.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(constraint_type:, level:, message:, target:) ⇒ ConstraintError
constructor
A new instance of ConstraintError.
- #to_s ⇒ Object
- #warning? ⇒ Boolean
Constructor Details
#initialize(constraint_type:, level:, message:, target:) ⇒ ConstraintError
Returns a new instance of ConstraintError.
463 464 465 466 467 468 |
# File 'lib/metaschema/constraint_validator.rb', line 463 def initialize(constraint_type:, level:, message:, target:) @constraint_type = constraint_type @level = level @message = @target = target end |
Instance Attribute Details
#constraint_type ⇒ Object (readonly)
Returns the value of attribute constraint_type.
461 462 463 |
# File 'lib/metaschema/constraint_validator.rb', line 461 def constraint_type @constraint_type end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
461 462 463 |
# File 'lib/metaschema/constraint_validator.rb', line 461 def level @level end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
461 462 463 |
# File 'lib/metaschema/constraint_validator.rb', line 461 def @message end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
461 462 463 |
# File 'lib/metaschema/constraint_validator.rb', line 461 def target @target end |
Instance Method Details
#error? ⇒ Boolean
474 475 476 |
# File 'lib/metaschema/constraint_validator.rb', line 474 def error? level == "ERROR" end |
#to_s ⇒ Object
470 471 472 |
# File 'lib/metaschema/constraint_validator.rb', line 470 def to_s "[#{level}] #{constraint_type}: #{} (target: #{target})" end |
#warning? ⇒ Boolean
478 479 480 |
# File 'lib/metaschema/constraint_validator.rb', line 478 def warning? level == "WARNING" end |