Class: PartialFinder::Printer

Inherits:
Object
  • Object
show all
Defined in:
lib/partial_finder/printer.rb

Overview

Printer class can accept and stringify any class that implements #structure such that #structure returns an array of Links.

Constant Summary collapse

TAB =
"  ".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graph) ⇒ Printer

Can be any class that has a #structure method



10
11
12
13
14
# File 'lib/partial_finder/printer.rb', line 10

def initialize(graph)
  @structure = graph.structure
  @string = ""
  structure.map{ |link| stringify_link(link) }
end

Instance Attribute Details

#stringObject (readonly)

Returns the value of attribute string.



5
6
7
# File 'lib/partial_finder/printer.rb', line 5

def string
  @string
end

#structureObject (readonly)

Returns the value of attribute structure.



5
6
7
# File 'lib/partial_finder/printer.rb', line 5

def structure
  @structure
end