Class: Chartify::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/chartify/factory.rb

Class Method Summary collapse

Class Method Details

.build(type, &block) ⇒ Object

Parameters:

  • type

    can be of line, pie, bar etc



11
12
13
14
15
16
# File 'lib/chartify/factory.rb', line 11

def self.build(type, &block)
  raise "type has to be a symbol" unless type.kind_of? Symbol
  chart = "Chartify::#{type.to_s.camelize}Chart".constantize.new
  block.call chart
  chart
end