Class: Wlog::TemplateEngine
- Inherits:
-
Object
- Object
- Wlog::TemplateEngine
- Defined in:
- lib/wlog/domain/template_engine.rb
Overview
Instance Attribute Summary collapse
-
#issue_sep ⇒ Object
What to separate issues with.
-
#issues ⇒ Object
An issue list.
-
#log_entry_sep ⇒ Object
What to separate log entries with.
Instance Method Summary collapse
- #generate(filename) ⇒ Object
-
#initialize(issue_sep, log_entry_sep, issues, invoice_id) ⇒ TemplateEngine
constructor
These can either be atomic elements, or arrays of two.
Constructor Details
#initialize(issue_sep, log_entry_sep, issues, invoice_id) ⇒ TemplateEngine
These can either be atomic elements, or arrays of two. In the former, they just join entries by adding the separator. The latter makes the two a prefix, and postfix.
17 18 19 20 |
# File 'lib/wlog/domain/template_engine.rb', line 17 def initialize(issue_sep, log_entry_sep, issues, invoice_id) @issue_sep, @log_entry_sep, @issues, @invoice_id = \ issue_sep, log_entry_sep, issues, invoice_id end |
Instance Attribute Details
#issue_sep ⇒ Object
What to separate issues with
28 29 30 |
# File 'lib/wlog/domain/template_engine.rb', line 28 def issue_sep @issue_sep end |
#issues ⇒ Object
An issue list
34 35 36 |
# File 'lib/wlog/domain/template_engine.rb', line 34 def issues @issues end |
#log_entry_sep ⇒ Object
What to separate log entries with
31 32 33 |
# File 'lib/wlog/domain/template_engine.rb', line 31 def log_entry_sep @log_entry_sep end |
Instance Method Details
#generate(filename) ⇒ Object
22 23 24 25 |
# File 'lib/wlog/domain/template_engine.rb', line 22 def generate(filename) contents = File.open(filename).read contens.gsub(InvoiceId, @invoice_id) end |