Class: BoostInfo::Generator
- Inherits:
-
Object
- Object
- BoostInfo::Generator
- Defined in:
- lib/boost_info/generator.rb
Instance Method Summary collapse
-
#initialize(root_node, opts = {}) ⇒ Generator
constructor
A new instance of Generator.
- #to_hash ⇒ Object
- #to_info ⇒ Object
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_hash ⇒ Object
9 10 11 |
# File 'lib/boost_info/generator.rb', line 9 def to_hash build_hash(@root_node) end |
#to_info ⇒ Object
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 |