Class: BoostInfo::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/boost_info/generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(root_node, opts = {}) ⇒ Generator

Returns a new instance of Generator.



3
4
5
6
7
# File 'lib/boost_info/generator.rb', line 3

def initialize(root_node, opts={})
  @root_node = root_node
  @opts = opts
  @opts[:indent] ||= 4
end

Instance Method Details

#to_hashObject



9
10
11
# File 'lib/boost_info/generator.rb', line 9

def to_hash
  build_hash(@root_node)
end

#to_infoObject



13
14
15
16
17
18
19
20
# File 'lib/boost_info/generator.rb', line 13

def to_info
  lines = build_info(@root_node, 0)
  if lines.empty?
    ''
  else
    lines.join("\n") + "\n"
  end
end