Class: SmartCore::Types::Primitive::InvariantControl::Single Private
- Inherits:
-
Object
- Object
- SmartCore::Types::Primitive::InvariantControl::Single
- Defined in:
- lib/smart_core/types/primitive/invariant_control/single.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
Classes: Result
Instance Attribute Summary collapse
- #name ⇒ String readonly private
Class Method Summary collapse
Instance Method Summary collapse
- #check(value, runtime_attributes) ⇒ SmartCore::Types::Primitive::InvariantControl::Single::Result private
- #initialize(name, invariant_checker) ⇒ void constructor private
- #simply_check(value, runtime_attributes) ⇒ Boolean private
Constructor Details
#initialize(name, invariant_checker) ⇒ 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.
33 34 35 36 |
# File 'lib/smart_core/types/primitive/invariant_control/single.rb', line 33 def initialize(name, invariant_checker) @name = name.dup.tap(&:freeze) @invariant_checker = invariant_checker end |
Instance Attribute Details
#name ⇒ String (readonly)
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.
25 26 27 |
# File 'lib/smart_core/types/primitive/invariant_control/single.rb', line 25 def name @name end |
Class Method Details
.create(name, invariant_checker) ⇒ SmartCore::Types::Primitive::InvariantControl::Single
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.
16 17 18 |
# File 'lib/smart_core/types/primitive/invariant_control/single.rb', line 16 def create(name, invariant_checker) new(name.to_s, invariant_checker) end |
Instance Method Details
#check(value, runtime_attributes) ⇒ SmartCore::Types::Primitive::InvariantControl::Single::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.
45 46 47 48 |
# File 'lib/smart_core/types/primitive/invariant_control/single.rb', line 45 def check(value, runtime_attributes) validation_result = !!invariant_checker.call(value, runtime_attributes) Result.new(self, value, validation_result) 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.
56 57 58 |
# File 'lib/smart_core/types/primitive/invariant_control/single.rb', line 56 def simply_check(value, runtime_attributes) !!invariant_checker.call(value, runtime_attributes) end |