Class: DrawioDsl::Schema::Anchor

Inherits:
Node
  • Object
show all
Defined in:
lib/drawio_dsl/schema/virtual/anchor.rb

Overview

Provides an anchor point on the page for elements to hang from

Instance Attribute Summary

Attributes inherited from Node

#classification, #id, #key, #nodes, #page, #parent

Instance Method Summary collapse

Methods inherited from Node

#add_node, #debug, #debug_detail, #debug_row, #root?, #to_h

Constructor Details

#initialize(page, **args) ⇒ Anchor

Returns a new instance of Anchor.



7
8
9
10
# File 'lib/drawio_dsl/schema/virtual/anchor.rb', line 7

def initialize(page, **args)
  args[:classification] = :anchor
  super(page, **args)
end

Instance Method Details

#as_xml(xml) ⇒ Object

xml.mxCell(id: “#DrawioDsl::Schema::Anchor.pagepage.id-A”) xml.mxCell(id: “#DrawioDsl::Schema::Anchor.pagepage.id-B”, parent: “#DrawioDsl::Schema::Anchor.pagepage.id-A”)



15
16
17
18
19
20
21
22
23
# File 'lib/drawio_dsl/schema/virtual/anchor.rb', line 15

def as_xml(xml)
  if parent
    xml.mxCell(id: id, parent: parent.id)
  else
    xml.mxCell(id: id)
  end

  nodes.as_xml(xml)
end