Class: SmartCore::Types::Primitive::RuntimeAttributesChecker Private
- Inherits:
-
Object
- Object
- SmartCore::Types::Primitive::RuntimeAttributesChecker
- Defined in:
- lib/smart_core/types/primitive/runtime_attributes_checker.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.
Constant Summary collapse
- ATTRIBUTES_IS_NOT_ALLOWED_CHECKER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
proc do |attrs| attrs.empty? || raise(SmartCore::Types::RuntimeAttriburtesUnsupportedError, <<~ERROR_MESSAGE) This type has no support for runtime attributes. ERROR_MESSAGE end.freeze
Instance Method Summary collapse
- #___assign_type___(type) ⇒ void private
- #___copy_for___(type) ⇒ SmartCore::Types::Primitive::RuntimeAttributesChecker private
- #check!(runtime_attributes) ⇒ void private
- #initialize(attributes_checker) ⇒ void constructor private
Constructor Details
#initialize(attributes_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.
21 22 23 24 |
# File 'lib/smart_core/types/primitive/runtime_attributes_checker.rb', line 21 def initialize(attributes_checker) @type = nil @attributes_checker = attributes_checker || ATTRIBUTES_IS_NOT_ALLOWED_CHECKER end |
Instance Method Details
#___assign_type___(type) ⇒ 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.
This method returns an undefined value.
42 43 44 |
# File 'lib/smart_core/types/primitive/runtime_attributes_checker.rb', line 42 def ___assign_type___(type) @type = type end |
#___copy_for___(type) ⇒ SmartCore::Types::Primitive::RuntimeAttributesChecker
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.
31 32 33 34 35 |
# File 'lib/smart_core/types/primitive/runtime_attributes_checker.rb', line 31 def ___copy_for___(type) self.class.new(attributes_checker).tap do |instance_copy| instance_copy.___assign_type___(type) end end |
#check!(runtime_attributes) ⇒ 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.
This method returns an undefined value.
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/smart_core/types/primitive/runtime_attributes_checker.rb', line 53 def check!(runtime_attributes) unless !!attributes_checker.call(runtime_attributes) # TODO (0.x.0): # Full type name (with type category; and delegated to the type object). # (main problem: sum and mult types has no type name and type category) raise(SmartCore::Types::IncorrectRuntimeAttributesError, <<~ERROR_MESSAGE) Incorrect runtime attributes for #{type.name}. ERROR_MESSAGE end end |