Class: HackBoxen::Template
- Inherits:
-
Object
- Object
- HackBoxen::Template
- Defined in:
- lib/hackboxen/template.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#source_template ⇒ Object
Returns the value of attribute source_template.
Instance Method Summary collapse
- #compile! ⇒ Object
-
#initialize(source_template, output_path, attributes) ⇒ Template
constructor
A new instance of Template.
- #substitute! ⇒ Object
Constructor Details
#initialize(source_template, output_path, attributes) ⇒ Template
Returns a new instance of Template.
8 9 10 11 12 |
# File 'lib/hackboxen/template.rb', line 8 def initialize source_template, output_path, attributes @source_template = source_template @output_path = output_path @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/hackboxen/template.rb', line 6 def attributes @attributes end |
#output_path ⇒ Object
Returns the value of attribute output_path.
6 7 8 |
# File 'lib/hackboxen/template.rb', line 6 def output_path @output_path end |
#source_template ⇒ Object
Returns the value of attribute source_template.
6 7 8 |
# File 'lib/hackboxen/template.rb', line 6 def source_template @source_template end |
Instance Method Details
#compile! ⇒ Object
14 15 16 17 18 |
# File 'lib/hackboxen/template.rb', line 14 def compile! dest << Erubis::Eruby.new(source).result(attributes) dest << "\n" dest end |
#substitute! ⇒ Object
20 21 22 |
# File 'lib/hackboxen/template.rb', line 20 def substitute! compile! end |