Class: Interdependence::Dependency::Base
- Inherits:
-
Object
- Object
- Interdependence::Dependency::Base
- Includes:
- Adamantium
- Defined in:
- lib/interdependence/dependency/base.rb
Overview
Base dependency wrapper class
Instance Method Summary collapse
-
#==(other) ⇒ true, false
(also: #eql?)
private
Is the other instance equivalent to this instance.
-
#clone ⇒ Dependency::Base
private
Clone class.
-
#dependencies ⇒ ObservableDependencySetGraph
private
Cloned copy of #validator_class‘s dependencies.
-
#field ⇒ Field, UnsetField
private
Field of dependency.
-
#field=(field) ⇒ undefined
private
Set field of dependency.
-
#field_name ⇒ Symbol
private
Get name of field.
-
#field_name= ⇒ undefined
private
Set name of field.
-
#inspect ⇒ String
private
Make dependencies more readable.
-
#options ⇒ Hash
private
Options for #validator_class (coerced with Types::OptionsCoercer).
-
#options=(options) ⇒ undefined
private
Set options.
-
#unset_equivalent_of?(other) ⇒ true, false
private
Is this instance the equivalent of ‘other` with unset attributes.
-
#unspecified_field? ⇒ true, false
private
is #field unset?.
-
#unspecified_options? ⇒ true, false
private
is #options unset?.
-
#validator_class ⇒ Class
private
Validator class of dependency (coerced with Types::ValidatorClassCoercer).
-
#validator_class=(validator_class) ⇒ undefined
private
Set validator class.
Instance Method Details
#==(other) ⇒ true, false Also known as: eql?
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 the other instance equivalent to this instance
136 137 138 139 140 141 |
# File 'lib/interdependence/dependency/base.rb', line 136 def ==(other) other.is_a?(Base) && validator_class.equal?(other.validator_class) && field.eql?(other.field) && .eql?(other.) end |
#clone ⇒ Dependency::Base
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.
Clone class
73 74 75 |
# File 'lib/interdependence/dependency/base.rb', line 73 def clone self.class.new(self) end |
#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.
Cloned copy of #validator_class‘s dependencies
149 150 151 |
# File 'lib/interdependence/dependency/base.rb', line 149 def dependencies validator_class.dependencies.clone end |
#field ⇒ Field, UnsetField
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 dependency
26 |
# File 'lib/interdependence/dependency/base.rb', line 26 attribute :field, Types::Field, coercer: Types::FieldCoercer |
#field=(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.
Set field of dependency
26 |
# File 'lib/interdependence/dependency/base.rb', line 26 attribute :field, Types::Field, coercer: Types::FieldCoercer |
#field_name ⇒ 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.
Get name of field
164 |
# File 'lib/interdependence/dependency/base.rb', line 164 delegate :name, to: :field, prefix: true |
#field_name= ⇒ 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 name of field
174 |
# File 'lib/interdependence/dependency/base.rb', line 174 delegate :name=, to: :field, prefix: true |
#inspect ⇒ String
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.
Make dependencies more readable
83 84 85 86 87 |
# File 'lib/interdependence/dependency/base.rb', line 83 def inspect inspect_field = unspecified_field? ? '*' : field.name.inspect "\e[1;36m#<#{self.class} #{validator_class}(#{inspect_field}, #{.inspect})>\e[0m" end |
#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.
Options for #validator_class (coerced with Types::OptionsCoercer). Memoized
63 |
# File 'lib/interdependence/dependency/base.rb', line 63 attribute :options, Hash, coercer: Types::OptionsCoercer |
#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 options
63 |
# File 'lib/interdependence/dependency/base.rb', line 63 attribute :options, Hash, coercer: Types::OptionsCoercer |
#unset_equivalent_of?(other) ⇒ true, 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 this instance the equivalent of ‘other` with unset attributes
121 122 123 124 125 |
# File 'lib/interdependence/dependency/base.rb', line 121 def unset_equivalent_of?(other) unspecified_field? && ( || .eql?(other.)) && validator_class.equal?(other.validator_class) end |
#unspecified_field? ⇒ true, 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 #field unset?
96 97 98 |
# File 'lib/interdependence/dependency/base.rb', line 96 def unspecified_field? field.instance_of?(Types::UnsetField) end |
#unspecified_options? ⇒ true, 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 #options unset?
107 108 109 |
# File 'lib/interdependence/dependency/base.rb', line 107 def .instance_of?(Types::UnsetOptions) end |
#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 of dependency (coerced with Types::ValidatorClassCoercer)
44 |
# File 'lib/interdependence/dependency/base.rb', line 44 attribute :validator_class, Class, coercer: Types::ValidatorClassCoercer, strict: true |
#validator_class=(validator_class) ⇒ 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 class
44 |
# File 'lib/interdependence/dependency/base.rb', line 44 attribute :validator_class, Class, coercer: Types::ValidatorClassCoercer, strict: true |