Method: Chartify::Factory.build

Defined in:
lib/chartify/factory.rb

.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