class SyntaxTree::Mermaid::Node
to be passed around to #link methods to create links between nodes.
be used directly. It is the return value of the #node method, and is meant
This class represents a node in a flowchart. Unlike the Link class, it can
def bounds
def bounds case shape when :circle %w[(( ))] when :rectangle ["[", "]"] when :rounded %w[( )] when :stadium ["([", "])"] end end
def initialize(id, label, shape)
def initialize(id, label, shape) raise unless SHAPES.include?(shape) @id = id @label = label @shape = shape end
def render
def render left_bound, right_bound = bounds "#{id}#{left_bound}#{Mermaid.escape(label)}#{right_bound}" end