Module: Interdependence::CommonMixin::ClassMethods
- Defined in:
- lib/interdependence/common_mixin.rb
Overview
Instance Method Summary collapse
-
#add_interdependent_validator(field, validator, options) ⇒ undefined
private
Add validator and merge its dependencies.
-
#clear_dependencies! ⇒ undefined
private
Resets dependencies to a new ObservableDependencySetGraph.
-
#inherited(base) ⇒ undefined
private
Handle dependencies on inheritance.
Instance Method Details
#add_interdependent_validator(field, validator, 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.
Add validator and merge its dependencies
64 65 66 67 68 69 70 71 |
# File 'lib/interdependence/common_mixin.rb', line 64 def add_interdependent_validator(field, validator, ) self::Validator.new( owner: self, field: field, validator_class: validator, options: ).save end |
#clear_dependencies! ⇒ 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.
Resets dependencies to a new ObservableDependencySetGraph
79 80 81 |
# File 'lib/interdependence/common_mixin.rb', line 79 def clear_dependencies! self.dependencies = ObservableDependencySetGraph.new end |
#inherited(base) ⇒ 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.
Handle dependencies on inheritance
resets depenencies on base and then merges in a clone of the parent dependencies
47 48 49 50 51 52 |
# File 'lib/interdependence/common_mixin.rb', line 47 def inherited(base) super base.clear_dependencies! base.dependencies.merge!(dependencies.clone) end |