Class: Swoop::ChartRenderer
- Defined in:
- lib/swoop/renderer/chart_renderer.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Attributes inherited from Renderer
Instance Method Summary collapse
- #class_count_data ⇒ Object
- #class_percentage_data ⇒ Object
-
#initialize(reports, title, filename = "index.html") ⇒ ChartRenderer
constructor
A new instance of ChartRenderer.
- #render ⇒ Object
Constructor Details
#initialize(reports, title, filename = "index.html") ⇒ ChartRenderer
Returns a new instance of ChartRenderer.
9 10 11 12 |
# File 'lib/swoop/renderer/chart_renderer.rb', line 9 def initialize(reports, title, filename = "index.html") super(reports, title) @filename = filename end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
7 8 9 |
# File 'lib/swoop/renderer/chart_renderer.rb', line 7 def filename @filename end |
Instance Method Details
#class_count_data ⇒ Object
14 15 16 17 18 19 |
# File 'lib/swoop/renderer/chart_renderer.rb', line 14 def class_count_data rows = [] rows << ['Date', 'Swift Class', 'Objective-C Class'] rows += reports.map { |r| [ "#{r.name}\n(#{r.date})", r.swift_classes_count, r.objc_classes_count] } rows.to_s end |
#class_percentage_data ⇒ Object
21 22 23 24 25 26 |
# File 'lib/swoop/renderer/chart_renderer.rb', line 21 def class_percentage_data rows = [] rows << ['Date', 'Swift Class (%)', 'Objective-C Class (%)'] rows += reports.map { |r| [ "#{r.name}\n(#{r.date})", r.swift_classes_percentage, r.objc_classes_percentage] } rows.to_s end |
#render ⇒ Object
28 29 30 31 32 |
# File 'lib/swoop/renderer/chart_renderer.rb', line 28 def render empty_target_dir html_path = render_html `open #{html_path}` end |