Class: Interdependence::Validator::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/interdependence/validator/validator.rb

Overview

Interdependence validator wrapper

Instance Method Summary collapse

Instance Method Details

#fieldSymbol

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 that #validator_class will validate

Returns:

  • (Symbol)

    field name



22
# File 'lib/interdependence/validator/validator.rb', line 22

attribute :field, Symbol

#new_dependencyDependency::Validator

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.

Delegated method to #resolver for creating new Dependency::Validator



54
# File 'lib/interdependence/validator/validator.rb', line 54

delegate :dependencies, :new_dependency, to: :resolver

#resolverDependencyResolver::Validator

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



83
84
85
# File 'lib/interdependence/validator/validator.rb', line 83

def resolver
  @resolver ||= DependencyResolver::Validator.new(self)
end

#saveObservableDependencySetGraph

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.

Observe new dependency and merge its dependencies into #validator‘s

Returns:



72
73
74
75
# File 'lib/interdependence/validator/validator.rb', line 72

def save
  validator_dependencies[validator.as_dependency] << new_observed_dependency
  validator_dependencies.merge!(dependencies)
end

#validatorClass

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 that owns #validator_class

Returns:

  • (Class)

    validator dependency



14
# File 'lib/interdependence/validator/validator.rb', line 14

attribute :validator, Class

#validator_classClass

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.

ActiveModel::Validator class that is owned by #validator

Returns:

  • (Class)

    class guaranteed to be a descendant of ActiveModel::Validator



30
# File 'lib/interdependence/validator/validator.rb', line 30

attribute :validator_class, Class, coercer: Types::ValidatorClassCoercer, strict: true

#validator_dependenciesObservableDependencySetGraph

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.

Delegated method to #validator for accessing dependency graph



64
# File 'lib/interdependence/validator/validator.rb', line 64

delegate :dependencies, to: :validator, prefix: true