Class: Compendium::Presenters::Chart
- Defined in:
- app/classes/compendium/presenters/chart.rb
Instance Attribute Summary collapse
-
#chart_provider ⇒ Object
readonly
Returns the value of attribute chart_provider.
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Attributes inherited from Query
#metrics, #name, #options, #proc, #report, #results
Instance Method Summary collapse
-
#initialize(template, object, *args, &setup) ⇒ Chart
constructor
A new instance of Chart.
- #render ⇒ Object
Methods inherited from Query
#add_metric, #empty?, #initialize_clone, #nil?, #ran?, #render_chart, #render_table, #run
Constructor Details
#initialize(template, object, *args, &setup) ⇒ Chart
Returns a new instance of Chart.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/classes/compendium/presenters/chart.rb', line 8 def initialize(template, object, *args, &setup) = args. type, container = args super(template, object) @data = [:index] ? results.records[[:index]] : results @data = @data.records if @data.is_a?(Compendium::ResultSet) @data = @data[0...-1] if query.[:totals] @container = container || query.name initialize_chart_provider(type, &setup) end |
Instance Attribute Details
#chart_provider ⇒ Object (readonly)
Returns the value of attribute chart_provider.
6 7 8 |
# File 'app/classes/compendium/presenters/chart.rb', line 6 def chart_provider @chart_provider end |
#container ⇒ Object (readonly)
Returns the value of attribute container.
6 7 8 |
# File 'app/classes/compendium/presenters/chart.rb', line 6 def container @container end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'app/classes/compendium/presenters/chart.rb', line 6 def data @data end |
Instance Method Details
#render ⇒ Object
23 24 25 |
# File 'app/classes/compendium/presenters/chart.rb', line 23 def render chart_provider.render(@template, @container) end |