Class: Booky::Layout::Base::Chart
- Includes:
- Helpers
- Defined in:
- lib/booky/layout/base/chart.rb
Instance Attribute Summary
Attributes inherited from Element
#ast, #document, #index, #options
Instance Method Summary collapse
Methods included from Helpers
#add_to_toc, #is_first_rendering?, #update_levels
Methods inherited from Element
#initialize, #method_missing, #next_option, #previous_option
Constructor Details
This class inherits a constructor from Booky::Layout::Element
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Booky::Layout::Element
Instance Method Details
#create_chart ⇒ Object
13 14 15 16 17 18 |
# File 'lib/booky/layout/base/chart.rb', line 13 def create_chart klass = Charts.const_get @data['type'].capitalize klass.new(@options, @document, @layout, @data).to_prawn move_down 1.cm end |
#parse_json ⇒ Object
9 10 11 |
# File 'lib/booky/layout/base/chart.rb', line 9 def parse_json @data = JSON.parse(File.read(@options[:json])) end |
#to_prawn ⇒ Object
20 21 22 23 |
# File 'lib/booky/layout/base/chart.rb', line 20 def to_prawn parse_json create_chart end |