Class: SmartCore::Types::Primitive::InvariantControl Private
- Inherits:
-
Object
- Object
- SmartCore::Types::Primitive::InvariantControl
- Defined in:
- lib/smart_core/types/primitive/invariant_control.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Modules: Factory Classes: Chain, Result, Single
Class Method Summary collapse
Instance Method Summary collapse
- #check(value, runtime_attributes) ⇒ SmartCore::Types::Primitive::InvariantControl::Result private
- #initialize(invariant_chains, invariants) ⇒ void constructor private
- #simply_check(value, runtime_attributes) ⇒ Boolean private
Constructor Details
#initialize(invariant_chains, invariants) ⇒ void
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.
30 31 32 33 |
# File 'lib/smart_core/types/primitive/invariant_control.rb', line 30 def initialize(invariant_chains, invariants) @invariant_chains = invariant_chains @invariants = invariants end |
Class Method Details
.create(invariant_chains, invariants) ⇒ SmartCore::Types::Primitive::InvariantControl
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.
19 20 21 |
# File 'lib/smart_core/types/primitive/invariant_control.rb', line 19 def create(invariant_chains, invariants) Factory.create(invariant_chains, invariants) end |
Instance Method Details
#check(value, runtime_attributes) ⇒ SmartCore::Types::Primitive::InvariantControl::Result
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.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/smart_core/types/primitive/invariant_control.rb', line 42 def check(value, runtime_attributes) Result.new(self, value).tap do |result| invariant_chains.each do |chain| result.add_chain_result(chain.check(value, runtime_attributes)) end invariants.each do |invariant| result.add_single_result(invariant.check(value, runtime_attributes)) end end end |
#simply_check(value, runtime_attributes) ⇒ Boolean
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.
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/smart_core/types/primitive/invariant_control.rb', line 60 def simply_check(value, runtime_attributes) return false if invariant_chains.any? do |chain| chain.simply_check(value, runtime_attributes) == false end return false if invariants.any? do |invariant| invariant.simply_check(value, runtime_attributes) == false end true end |