Class: Puppet::Pops::Validation::Factory Abstract
- Defined in:
- lib/puppet/pops/validation.rb
Overview
Subclass must implement #checker, and #label_provider
This class is an abstract base implementation of a _model validation factory_ that creates a validator instance and associates it with a fully configured DiagnosticProducer.
A validator is responsible for validating a model. There may be different versions of validation available for one and the same model; e.g. different semantics for different puppet versions, or different types of validation configuration depending on the context/type of validation that should be performed (static, vs. runtime, etc.).
This class is abstract and must be subclassed. The subclass must implement the methods #label_provider and #checker. It is also expected that the subclass will override the severity_producer and configure the issues that should be reported as errors (i.e. if they should be ignored, produce a warning, or a deprecation warning).
Direct Known Subclasses
Instance Method Summary collapse
-
#checker(diagnostic_producer) ⇒ Object
abstract
Produces the checker to use.
-
#diagnostic_producer(acceptor) ⇒ DiagnosticProducer
Produces the diagnostics producer to use given an acceptor of issues.
-
#label_provider ⇒ Object
abstract
Produces the label provider to use.
-
#severity_producer ⇒ SeverityProducer
Produces the SeverityProducer to use Subclasses should implement and add specific overrides.
-
#validator(acceptor) ⇒ #validate
Produces a validator with the given acceptor as the recipient of produced diagnostics.
Instance Method Details
#checker(diagnostic_producer) ⇒ Object
Produces the checker to use.
69 70 71 |
# File 'lib/puppet/pops/validation.rb', line 69 def checker(diagnostic_producer) raise NoMethodError, "checker" end |
#diagnostic_producer(acceptor) ⇒ DiagnosticProducer
Produces the diagnostics producer to use given an acceptor of issues.
48 49 50 |
# File 'lib/puppet/pops/validation.rb', line 48 def diagnostic_producer(acceptor) DiagnosticProducer.new(acceptor, severity_producer(), label_provider()) end |
#label_provider ⇒ Object
Produces the label provider to use.
79 80 81 |
# File 'lib/puppet/pops/validation.rb', line 79 def label_provider raise NoMethodError, "label_provider" end |
#severity_producer ⇒ SeverityProducer
Produces the SeverityProducer to use Subclasses should implement and add specific overrides
59 60 61 |
# File 'lib/puppet/pops/validation.rb', line 59 def severity_producer SeverityProducer.new end |
#validator(acceptor) ⇒ #validate
Produces a validator with the given acceptor as the recipient of produced diagnostics. The acceptor is where detected issues are received (and typically collected).
37 38 39 |
# File 'lib/puppet/pops/validation.rb', line 37 def validator(acceptor) checker(diagnostic_producer(acceptor)) end |