Class: Interdependence::Model::Validator

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

Overview

Validator wrapper for validators added to model classes

Instance Method Summary collapse

Instance Method Details

#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.

Dependencies from resolver



76
# File 'lib/interdependence/model/validator.rb', line 76

delegate :dependencies, to: :resolver

#fieldundefined

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

#modelClass

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

#optionsHash

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 options=(options)
  self.substitutions = options.fetch(:dependencies, {})
  super
end

#resolverDependencyResolver::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

#saveundefined

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

#substitutionsHash{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_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.

Validator class



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

attribute :validator_class, Class