Module: Moon::EntitySystem::Component::InstanceMethods

Defined in:
lib/moon/packages/entity_system/component.rb

Instance Method Summary collapse

Instance Method Details

#as_inheritanceObject


53
54
55
# File 'lib/moon/packages/entity_system/component.rb', line 53

def as_inheritance
  { symbol => to_h }
end

#exportObject


44
45
46
# File 'lib/moon/packages/entity_system/component.rb', line 44

def export
  to_h.merge(component_type: symbol).stringify_keys
end

#import(data) ⇒ Object


48
49
50
51
# File 'lib/moon/packages/entity_system/component.rb', line 48

def import(data)
  setup(data)
  self
end

#initialize(options = {}) ⇒ Object


22
23
24
# File 'lib/moon/packages/entity_system/component.rb', line 22

def initialize(options = {})
  setup(options)
end

#symbolObject


26
27
28
# File 'lib/moon/packages/entity_system/component.rb', line 26

def symbol
  self.class.registered
end

#to_hObject


40
41
42
# File 'lib/moon/packages/entity_system/component.rb', line 40

def to_h
  fields_hash
end