Class: Treedent::NodeDrawing

Inherits:
Struct
  • Object
show all
Defined in:
lib/treedent/node_drawing.rb

Constant Summary collapse

SPACE =
"    "
BAR =
"│   "
TEE =
"├── "
CORNER =
"└── "

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nodeObject

Returns the value of attribute node

Returns:

  • (Object)

    the current value of node



2
3
4
# File 'lib/treedent/node_drawing.rb', line 2

def node
  @node
end

Instance Method Details

#drawingsObject



12
13
14
15
# File 'lib/treedent/node_drawing.rb', line 12

def drawings
  return [] if node.orphan?
  [outer_indentation, inner_indentation].flatten
end

#to_sObject



8
9
10
# File 'lib/treedent/node_drawing.rb', line 8

def to_s
  [drawings, node.value.content].compact.join
end