Class: BaseGenerator
- Inherits:
-
Object
- Object
- BaseGenerator
- Defined in:
- lib/chart_generators/base_generator.rb
Direct Known Subclasses
BubbleChartGenerator, HistogramGenerator, HorizontalBarChartGenerator, LineChartGenerator, PieChartGenerator, PolarAreaDiagramGenerator, RadarChartGenerator, StreamgraphGenerator, TreemapGenerator, VerticalBarChartGenerator
Instance Method Summary collapse
-
#add_assets(f_name, code) ⇒ Object
generate assets for chart ( .js and .css ) and put them into rails assets path.
-
#css_code(element) ⇒ Object
get chart’s css-code form template.
-
#js_code(element, data) ⇒ Object
get chart’s js-code form template.
Instance Method Details
#add_assets(f_name, code) ⇒ Object
generate assets for chart ( .js and .css ) and put them into rails assets path
5 6 7 8 9 |
# File 'lib/chart_generators/base_generator.rb', line 5 def add_assets( f_name, code ) d_path = create_dir( f_name ) f_path = file_path( d_path, f_name ) make_file( f_path, code ) end |
#css_code(element) ⇒ Object
get chart’s css-code form template
18 19 20 21 |
# File 'lib/chart_generators/base_generator.rb', line 18 def css_code( element ) erb = ERB.new( temp_scss ) erb.result( binding ) end |
#js_code(element, data) ⇒ Object
get chart’s js-code form template
12 13 14 15 |
# File 'lib/chart_generators/base_generator.rb', line 12 def js_code( element, data ) erb = ERB.new( temp_js ) erb.result( binding ) end |