Class: Interdependence::Dependency::Model

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

Overview

Model dependency wrapper

Instance Method Summary collapse

Methods inherited from Base

#==, #clone, #field, #field=, #field_name, #field_name=, #inspect, #options, #options=, #unset_equivalent_of?, #unspecified_field?, #unspecified_options?, #validator_class, #validator_class=

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 clone with self replacing the unset equivalent dependency

Returns:



30
31
32
33
34
# File 'lib/interdependence/dependency/model.rb', line 30

def dependencies
  super.change_owner(new_owner: self) do |current_owner|
    current_owner.unset_equivalent_of?(self)
  end
end

#proxy_field?false

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.

Is class a proxy field?

Returns:

  • (false)


20
21
22
# File 'lib/interdependence/dependency/model.rb', line 20

def proxy_field?
  false
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 dependency

Returns:

  • (Hash{Symbol => Symbol})
    substitution map


11
# File 'lib/interdependence/dependency/model.rb', line 11

attribute :substitutions, Hash

#to_active_modelArray

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.

Formats dependency as parameters for ActiveModel::Model#validates

Returns:

  • (Array)

    active model parameters



42
43
44
# File 'lib/interdependence/dependency/model.rb', line 42

def to_active_model
  [validator_class, active_model_options.merge(attributes: [field_name])]
end