class MyChart::Chart

Attributes

chart_tags[R]

Public Instance Methods

generate() click to toggle source
# File lib/my_chart.rb, line 32
def generate
  generate_charts
  generate_files
end
plain_tags() click to toggle source
# File lib/my_chart.rb, line 37
def plain_tags
  chart_tags.map &:default_html
end

Private Instance Methods

filled_template(tmpl_file) click to toggle source
# File lib/my_chart.rb, line 57
def filled_template tmpl_file
  @filled ||= {}
  return @filled[tmpl_file] if @filled[tmpl_file]
  @filled[tmpl_file] = ERB.new(File.read tmpl_file).result(binding)
end
generate_charts() click to toggle source
# File lib/my_chart.rb, line 43
def generate_charts
  @chart_tags = charts.map do |id, chart|
    chart
  end
end
generate_files() click to toggle source
# File lib/my_chart.rb, line 49
def generate_files
  output_files and output_files.each do |path, tmpl|
    File.open path, 'w:utf-8' do |f|
      f.puts filled_template tmpl
    end
  end
end