Class: Archimate::Svg::Entity::Artifact

Inherits:
BaseEntity
  • Object
show all
Defined in:
lib/archimate/svg/entity/artifact.rb

Instance Attribute Summary

Attributes inherited from BaseEntity

#background_class, #badge, #badge_bounds, #bounds_offset, #child, #entity, #text_bounds

Instance Method Summary collapse

Methods inherited from BaseEntity

#entity_badge, #entity_label, #group_attrs, #optional_link, #shape_style, #text_lines, #text_style, #to_svg

Constructor Details

#initialize(child, bounds_offset) ⇒ Artifact

Returns a new instance of Artifact.



7
8
9
10
# File 'lib/archimate/svg/entity/artifact.rb', line 7

def initialize(child, bounds_offset)
  super
  @badge = "archimate-artifact-badge"
end

Instance Method Details

#entity_shape(xml, bounds) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/archimate/svg/entity/artifact.rb', line 12

def entity_shape(xml, bounds)
  margin = 18
  xml.g(class: background_class, style: shape_style) do
    xml.path(
      d: [
        ["M", bounds.left, bounds.top],
        ["h", bounds.width - margin],
        ["l", margin, margin],
        ["v", bounds.height - margin],
        ["h", -bounds.width],
        "z"
      ].flatten.join(" ")
    )
    xml.path(
      d: [
        ["M", bounds.right - margin, bounds.top],
        ["v", margin],
        ["h", margin],
        "z"
      ].flatten.join(" "),
      class: "archimate-decoration"
    )
  end
end