module UniverseCompiler::Entity::TypeManagement

Public Class Methods

extended(base) click to toggle source
# File lib/universe_compiler/entity/type_management.rb, line 67
def self.extended(base)
  included base.class
end
included(base) click to toggle source
# File lib/universe_compiler/entity/type_management.rb, line 63
def self.included(base)
  base.extend(ClassMethods)
end
type_class_mapping(type_or_class) click to toggle source

** Module methods to be directly used

# 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() click to toggle source
# File lib/universe_compiler/entity/type_management.rb, line 55
def self.types_classes_mapping
  @types_classes_mapping ||= {}
end
valid_for_type?(entity) click to toggle source
# 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

Public Instance Methods

type() click to toggle source

** The only instance method

# File lib/universe_compiler/entity/type_management.rb, line 74
def type
  self.class.entity_type
end