Module: UniverseCompiler::Entity::TypeManagement
- Included in:
- Base
- Defined in:
- lib/universe_compiler/entity/type_management.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
- .extended(base) ⇒ Object
- .included(base) ⇒ Object
-
.type_class_mapping(type_or_class) ⇒ Object
** Module methods to be directly used.
- .types_classes_mapping ⇒ Object
- .valid_for_type?(entity) ⇒ Boolean
Instance Method Summary collapse
-
#type ⇒ Object
** The only instance method.
Class Method Details
.extended(base) ⇒ Object
67 68 69 |
# File 'lib/universe_compiler/entity/type_management.rb', line 67 def self.extended(base) included base.class end |
.included(base) ⇒ Object
63 64 65 |
# File 'lib/universe_compiler/entity/type_management.rb', line 63 def self.included(base) base.extend(ClassMethods) end |
.type_class_mapping(type_or_class) ⇒ Object
** Module methods to be directly used
46 47 48 49 50 51 52 53 |
# File 'lib/universe_compiler/entity/type_management.rb', line 46 def self.type_class_mapping(type_or_class) case type_or_class when Symbol, String types_classes_mapping[type_or_class.to_sym] when Class type_or_class end end |
.types_classes_mapping ⇒ Object
55 56 57 |
# File 'lib/universe_compiler/entity/type_management.rb', line 55 def self.types_classes_mapping @types_classes_mapping ||= {} end |
.valid_for_type?(entity) ⇒ Boolean
59 60 61 |
# File 'lib/universe_compiler/entity/type_management.rb', line 59 def self.valid_for_type?(entity) entity.respond_to? :type and entity.class.respond_to? :entity_type end |
Instance Method Details
#type ⇒ Object
** The only instance method
74 75 76 |
# File 'lib/universe_compiler/entity/type_management.rb', line 74 def type self.class.entity_type end |