Class: SmartCore::Initializer::Attribute::Value::Base Private
- Inherits:
-
Object
- Object
- SmartCore::Initializer::Attribute::Value::Base
- Defined in:
- lib/smart_core/initializer/attribute/value/base.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
- PRIVACY_MODES =
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.
{ public: :public, protected: :protected, private: :private }.freeze
- DEFAULT_PRIVACY_MODE =
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.
PRIVACY_MODES[:public]
- DEFAULT_FINALIZER =
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 { |value| value }.freeze
- DEFAULT_AS =
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.
nil- DEFAULT_MUTABLE =
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.
false
Instance Attribute Summary collapse
- #as ⇒ String, ... readonly private
- #cast ⇒ Boolean (also: #cast?) readonly private
- #finalizer ⇒ SmartCore::Initializer::Attribute::Finalizer::AnonymousBlock, SmartCore::Initializer::Attribute::Finalizer::InstanceMethod readonly private
- #mutable ⇒ Boolean (also: #mutable?) readonly private
- #name ⇒ Symbol readonly private
- #privacy ⇒ Symbol readonly private
- #type ⇒ SmartCore::Initializer::TypeSystem::Interop readonly private
- #type_system ⇒ Class<SmartCore::Initilizer::TypeSystem::Interop> readonly private
Instance Method Summary collapse
- #initialize(name, type, type_system, privacy, finalizer, cast, mutable, as) ⇒ void constructor private
- #validate!(value) ⇒ void private
Constructor Details
#initialize(name, type, type_system, privacy, finalizer, cast, mutable, as) ⇒ 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.
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 103 def initialize(name, type, type_system, privacy, finalizer, cast, mutable, as) @name = name @type = type @type_system = type_system @privacy = privacy @finalizer = finalizer @cast = cast @mutable = mutable @as = as end |
Instance Attribute Details
#as ⇒ 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.
89 90 91 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 89 def as @as end |
#cast ⇒ Boolean (readonly) Also known as: cast?
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.
75 76 77 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 75 def cast @cast end |
#finalizer ⇒ SmartCore::Initializer::Attribute::Finalizer::AnonymousBlock, SmartCore::Initializer::Attribute::Finalizer::InstanceMethod (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.
69 70 71 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 69 def finalizer @finalizer end |
#mutable ⇒ Boolean (readonly) Also known as: mutable?
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.
82 83 84 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 82 def mutable @mutable end |
#name ⇒ Symbol (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.
44 45 46 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 44 def name @name end |
#privacy ⇒ Symbol (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.
62 63 64 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 62 def privacy @privacy end |
#type ⇒ SmartCore::Initializer::TypeSystem::Interop (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.
50 51 52 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 50 def type @type end |
#type_system ⇒ Class<SmartCore::Initilizer::TypeSystem::Interop> (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.
56 57 58 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 56 def type_system @type_system end |
Instance Method Details
#validate!(value) ⇒ 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.
119 120 121 122 123 124 125 126 127 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 119 def validate!(value) type.validate!(value) rescue => error # TODO: move to typesystem interop raise( SmartCore::Initializer::IncorrectTypeError, "Validation of attribute `#{name}` failed:" \ "(expected: #{type.identifier}, got: #{value.class}) \"#{error.message}\"" ) end |