Class: RakeReportTemplate
- Inherits:
-
Object
- Object
- RakeReportTemplate
- Defined in:
- lib/rake_report/template.rb
Instance Attribute Summary collapse
-
#colors ⇒ Object
Returns the value of attribute colors.
-
#template ⇒ Object
Returns the value of attribute template.
-
#timers ⇒ Object
Returns the value of attribute timers.
Instance Method Summary collapse
-
#initialize(timers) ⇒ RakeReportTemplate
constructor
A new instance of RakeReportTemplate.
- #render ⇒ Object
- #save(file) ⇒ Object
Constructor Details
#initialize(timers) ⇒ RakeReportTemplate
Returns a new instance of RakeReportTemplate.
5 6 7 8 9 |
# File 'lib/rake_report/template.rb', line 5 def initialize(timers) @colors = %w(#50ABD2 #78B653 #CAD04F #ED913D #E8182E) @template = template @timers = timers end |
Instance Attribute Details
#colors ⇒ Object
Returns the value of attribute colors.
4 5 6 |
# File 'lib/rake_report/template.rb', line 4 def colors @colors end |
#template ⇒ Object
Returns the value of attribute template.
4 5 6 |
# File 'lib/rake_report/template.rb', line 4 def template @template end |
#timers ⇒ Object
Returns the value of attribute timers.
4 5 6 |
# File 'lib/rake_report/template.rb', line 4 def timers @timers end |
Instance Method Details
#render ⇒ Object
55 56 57 |
# File 'lib/rake_report/template.rb', line 55 def render ERB.new(@template).result(binding) end |
#save(file) ⇒ Object
59 60 61 62 63 |
# File 'lib/rake_report/template.rb', line 59 def save(file) File.open(file, 'w') do |f| f.write(render) end end |