Class: SmartCore::Initializer::TypeSet Private
- Inherits:
-
Object
- Object
- SmartCore::Initializer::TypeSet
- Defined in:
- lib/smart_core/initializer/type_set.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.
Instance Method Summary collapse
- #has_type?(name) ⇒ Boolean private
- #initialize ⇒ void constructor private
- #register(name, checker) ⇒ void private
- #resolve(name) ⇒ SmartCore::Initializer::Type private
Constructor Details
#initialize ⇒ 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.
10 11 12 |
# File 'lib/smart_core/initializer/type_set.rb', line 10 def initialize @types = {} end |
Instance Method Details
#has_type?(name) ⇒ 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.
19 20 21 |
# File 'lib/smart_core/initializer/type_set.rb', line 19 def has_type?(name) types.key?(name) end |
#register(name, 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.
This method returns an undefined value.
29 30 31 32 |
# File 'lib/smart_core/initializer/type_set.rb', line 29 def register(name, checker) type = SmartCore::Initializer::Type.new(name, checker) types[type.name] = type end |
#resolve(name) ⇒ SmartCore::Initializer::Type
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.
39 40 41 42 43 |
# File 'lib/smart_core/initializer/type_set.rb', line 39 def resolve(name) types.fetch(name.to_sym) rescue KeyError raise SmartCore::Initializer::UnregisteredTypeError, "type :#{name} is not registered!" end |