Module: Archimate::Svg::EntityFactory

Defined in:
lib/archimate/svg/entity_factory.rb

Class Method Summary collapse

Class Method Details

.make_entity(child, bounds_offset) ⇒ Object

TODO:

this is wrong because it depends on ‘type` attribute



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/archimate/svg/entity_factory.rb', line 7

def make_entity(child, bounds_offset)
  if child.element
    klass_name = child.element.class.name.split("::").last
  else
    klass_name = child.type.sub('archimate:', '')
  end
  Entity.const_get(klass_name).new(child, bounds_offset)
rescue NameError
  Logging.logger.fatal "Unsupported entity type #{klass_name}"
  raise
end