Class: WorkflowTemplate::Validation::Evaluation::Abstract
- Inherits:
-
Object
- Object
- WorkflowTemplate::Validation::Evaluation::Abstract
- Defined in:
- lib/workflow_template/validation/evaluation/abstract.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#validator ⇒ Object
readonly
Returns the value of attribute validator.
Instance Method Summary collapse
- #call(data) ⇒ Object
- #describe ⇒ Object
- #evaluate(_result) ⇒ Object
-
#initialize(name, key, context, validator) ⇒ Abstract
constructor
A new instance of Abstract.
Constructor Details
#initialize(name, key, context, validator) ⇒ Abstract
Returns a new instance of Abstract.
16 17 18 19 20 21 22 |
# File 'lib/workflow_template/validation/evaluation/abstract.rb', line 16 def initialize(name, key, context, validator) @name = name.to_sym @key = key&.to_sym @context = context.freeze @validator = validator freeze end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
14 15 16 |
# File 'lib/workflow_template/validation/evaluation/abstract.rb', line 14 def context @context end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
14 15 16 |
# File 'lib/workflow_template/validation/evaluation/abstract.rb', line 14 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/workflow_template/validation/evaluation/abstract.rb', line 14 def name @name end |
#validator ⇒ Object (readonly)
Returns the value of attribute validator.
14 15 16 |
# File 'lib/workflow_template/validation/evaluation/abstract.rb', line 14 def validator @validator end |
Instance Method Details
#call(data) ⇒ Object
24 25 26 27 |
# File 'lib/workflow_template/validation/evaluation/abstract.rb', line 24 def call(data) result = run_validator(data) evaluate(result) end |
#describe ⇒ Object
33 34 35 |
# File 'lib/workflow_template/validation/evaluation/abstract.rb', line 33 def describe validator.describe end |
#evaluate(_result) ⇒ Object
29 30 31 |
# File 'lib/workflow_template/validation/evaluation/abstract.rb', line 29 def evaluate(_result) raise NotImplementedError, "#{self.class.name}##{__method__} unimplemented" end |