Class: Interdependence::Model::Validator
- Inherits:
-
Object
- Object
- Interdependence::Model::Validator
- Defined in:
- lib/interdependence/model/validator.rb
Overview
Validator wrapper for validators added to model classes
Instance Method Summary collapse
-
#dependencies ⇒ ObservableDependencySetGraph
private
Dependencies from resolver.
-
#field ⇒ undefined
private
Field of validator.
-
#model ⇒ Class
private
Model that owns this validator.
-
#options ⇒ Hash
private
Validator options hash.
-
#options=(options) ⇒ undefined
private
Set validator options hash.
-
#resolver ⇒ DependencyResolver::Model
private
Memoized resolver.
-
#save ⇒ undefined
private
Merge model dependencies with resolver dependencies.
-
#substitutions ⇒ Hash{Symbol => Symbol}
private
Map for substituting names on validator.
-
#validator_class ⇒ Class
private
Validator class.
Instance Method Details
#dependencies ⇒ ObservableDependencySetGraph
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Dependencies from resolver
76 |
# File 'lib/interdependence/model/validator.rb', line 76 delegate :dependencies, to: :resolver |
#field ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Field of validator
22 |
# File 'lib/interdependence/model/validator.rb', line 22 attribute :field, Symbol |
#model ⇒ Class
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Model that owns this validator
14 |
# File 'lib/interdependence/model/validator.rb', line 14 attribute :model, Class |
#options ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Validator options hash
38 |
# File 'lib/interdependence/model/validator.rb', line 38 attribute :options, Hash, default: {} |
#options=(options) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set validator options hash
64 65 66 67 |
# File 'lib/interdependence/model/validator.rb', line 64 def () self.substitutions = .fetch(:dependencies, {}) super end |
#resolver ⇒ DependencyResolver::Model
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Memoized resolver
94 95 96 |
# File 'lib/interdependence/model/validator.rb', line 94 def resolver @resolver ||= DependencyResolver::Model.new(self) end |
#save ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Merge model dependencies with resolver dependencies
84 85 86 |
# File 'lib/interdependence/model/validator.rb', line 84 def save model.dependencies.merge!(dependencies) end |
#substitutions ⇒ Hash{Symbol => Symbol}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Map for substituting names on validator
46 |
# File 'lib/interdependence/model/validator.rb', line 46 attribute :substitutions, Hash[Symbol => Symbol], default: {} |
#validator_class ⇒ Class
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Validator class
30 |
# File 'lib/interdependence/model/validator.rb', line 30 attribute :validator_class, Class |