Class: RakeReportTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/rake_report/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#colorsObject

Returns the value of attribute colors.



4
5
6
# File 'lib/rake_report/template.rb', line 4

def colors
  @colors
end

#templateObject

Returns the value of attribute template.



4
5
6
# File 'lib/rake_report/template.rb', line 4

def template
  @template
end

#timersObject

Returns the value of attribute timers.



4
5
6
# File 'lib/rake_report/template.rb', line 4

def timers
  @timers
end

Instance Method Details

#renderObject



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