Class: Tomahawk::Generators::Base
- Inherits:
-
Object
- Object
- Tomahawk::Generators::Base
- Includes:
- Tomahawk::Generators
- Defined in:
- lib/tomahawk/generators/base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(directive_group) ⇒ Base
constructor
A new instance of Base.
- #to_str ⇒ Object (also: #to_s)
Methods included from Tomahawk::Generators
#directive_group_name, #generate_directive
Constructor Details
#initialize(directive_group) ⇒ Base
Returns a new instance of Base.
6 7 8 |
# File 'lib/tomahawk/generators/base.rb', line 6 def initialize(directive_group) @directive_group = directive_group end |
Instance Method Details
#to_str ⇒ Object Also known as: to_s
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/tomahawk/generators/base.rb', line 10 def to_str config = "\n<#{directive_group_name} #{@directive_group.parameters}>\n" @directive_group.directives.each do |directive, value| config += generate_directive(directive, value) end @directive_group.groups.each do |group| config += group.to_s end config += "\n</#{directive_group_name}>\n" end |