Class: Compendium::AbstractChartProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/compendium/abstract_chart_provider.rb

Overview

Abstract wrapper for rendering charts To add a new chart provider, #initialize and #render must be implemented

Direct Known Subclasses

ChartProvider::AmCharts

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, data, &setup_proc) ⇒ AbstractChartProvider

Returns a new instance of AbstractChartProvider.

Raises:

  • (NotImplementedError)


9
10
11
# File 'lib/compendium/abstract_chart_provider.rb', line 9

def initialize(type, data, &setup_proc)
  raise NotImplementedError
end

Instance Attribute Details

#chartObject (readonly)

Returns the value of attribute chart.



7
8
9
# File 'lib/compendium/abstract_chart_provider.rb', line 7

def chart
  @chart
end

Class Method Details

.find_chart_providerObject

As more chart providers are added, this method will have to be extended to find them



18
19
20
21
22
23
24
# File 'lib/compendium/abstract_chart_provider.rb', line 18

def self.find_chart_provider
  if defined?(AmCharts)
    :AmCharts
  else
    self.name.demodulize.to_sym
  end
end

Instance Method Details

#render(template, container) ⇒ Object

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/compendium/abstract_chart_provider.rb', line 13

def render(template, container)
  raise NotImplementedError
end