Class: Archimate::Svg::Child

Inherits:
Object
  • Object
show all
Defined in:
lib/archimate/svg/child.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(child) ⇒ Child

Returns a new instance of Child.



9
10
11
12
# File 'lib/archimate/svg/child.rb', line 9

def initialize(child)
  @child = child
  @todos = Hash.new(0)
end

Instance Attribute Details

#childObject (readonly)

Returns the value of attribute child.



7
8
9
# File 'lib/archimate/svg/child.rb', line 7

def child
  @child
end

#todosObject (readonly)

Returns the value of attribute todos.



6
7
8
# File 'lib/archimate/svg/child.rb', line 6

def todos
  @todos
end

Instance Method Details

#render_elements(svg) ⇒ Object

The info needed to render is contained in the child with the exception of any offset needed. So this will need to be included in the recursive drawing of children



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/archimate/svg/child.rb', line 16

def render_elements(svg)
  Nokogiri::XML::Builder.with(svg) do |xml|
    entity = EntityFactory.make_entity(child, nil)
    if entity.nil?
      puts "Unable to make an SVG Entity for Child:\n#{child}"
    else
      entity.to_svg(xml)
    end
  end
  svg
end