Module: UniverseCompiler::Entity::TypeManagement::ClassMethods

Defined in:
lib/universe_compiler/entity/type_management.rb

Instance Method Summary collapse

Instance Method Details

#entity_type(value = nil) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/universe_compiler/entity/type_management.rb', line 8

def entity_type(value = nil)
  if value.nil?
    @entity_type || name.underscore
  else
    self.entity_type = value
  end
end

#entity_type=(value) ⇒ Object



16
17
18
19
20
# File 'lib/universe_compiler/entity/type_management.rb', line 16

def entity_type=(value)
  raise UniverseCompiler::Error, "You cannot change an entity type for class '#{self.name}'" unless @entity_type.nil?
  raise UniverseCompiler::Error, 'Only Symbol is supported for entity_type !' unless value.is_a? Symbol
  @entity_type = value
end