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
- #klass ⇒ Class 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(klass, name, type, type_system, privacy, finalizer, cast, mutable, as) ⇒ void constructor private
- #validate!(value) ⇒ void private
Constructor Details
#initialize(klass, 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.
111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 111 def initialize(klass, name, type, type_system, privacy, finalizer, cast, mutable, as) @klass = klass @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.
96 97 98 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 96 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.
82 83 84 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 82 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.
76 77 78 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 76 def finalizer @finalizer end |
#klass ⇒ Class (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.
45 46 47 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 45 def klass @klass 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.
89 90 91 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 89 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.
51 52 53 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 51 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.
69 70 71 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 69 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.
57 58 59 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 57 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.
63 64 65 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 63 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.
131 132 133 134 135 136 137 138 139 |
# File 'lib/smart_core/initializer/attribute/value/base.rb', line 131 def validate!(value) unless type.valid?(value) raise( SmartCore::Initializer::IncorrectTypeError, "Validation of attribute `#{klass}##{name}` failed. " \ "Expected: #{type.identifier}, got: #{truncate(value.inspect, 100)}", ) end end |