Class: Charty::PlotterAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/charty/plotter_adapter.rb

Direct Known Subclasses

GoogleChart, Gruff, PyPlot, Rubyplot

Class Method Summary collapse

Class Method Details

.create(adapter_name) ⇒ Object


10
11
12
13
14
15
# File 'lib/charty/plotter_adapter.rb', line 10

def self.create(adapter_name)
  require "charty/backends/#{adapter_name}"
  adapter = @adapters.find {|adapter| adapter::Name.to_s == adapter_name.to_s }
  raise AdapterNotLoadedError.new("Adapter for '#{adapter_name}' is not found.") unless adapter
  adapter.new
end

.inherited(adapter_class) ⇒ Object


5
6
7
8
# File 'lib/charty/plotter_adapter.rb', line 5

def self.inherited(adapter_class)
  @adapters ||= []
  @adapters << adapter_class
end