Module: Daru::View
- Defined in:
- lib/daru/view.rb,
lib/daru/view/plot.rb,
lib/daru/view/table.rb,
lib/daru/view/version.rb,
lib/daru/view/plot_list.rb,
lib/daru/view/adapters/nyaplot.rb,
lib/daru/view/app/rails/railtie.rb,
lib/daru/view/adapters/datatables.rb,
lib/daru/view/adapters/highcharts.rb,
lib/daru/view/adapters/googlecharts.rb,
lib/daru/view/app/rails/helpers/view_helper.rb
Defined Under Namespace
Modules: Adapter, Rails Classes: Engine, Plot, PlotList, Table
Constant Summary collapse
- VERSION =
'0.2.6'.freeze
Class Attribute Summary collapse
-
.plotting_library ⇒ Object
Returns the value of attribute plotting_library.
-
.table_library ⇒ Object
Returns the value of attribute table_library.
Class Method Summary collapse
-
.dependent_script(lib = :nyaplot) ⇒ void, String
dependent script for the library.
-
.dependent_scripts(libraries = []) ⇒ void, String
Dependent script for the libraries.
Class Attribute Details
.plotting_library ⇒ Object
Returns the value of attribute plotting_library.
27 28 29 |
# File 'lib/daru/view.rb', line 27 def plotting_library @plotting_library end |
.table_library ⇒ Object
Returns the value of attribute table_library.
27 28 29 |
# File 'lib/daru/view.rb', line 27 def table_library @table_library end |
Class Method Details
.dependent_script(lib = :nyaplot) ⇒ void, String
dependent script for the library. It must be added in the head tag of the web application.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/daru/view.rb', line 94 def dependent_script(lib=:nyaplot) load_lib_in_iruby(lib.to_s) if defined? IRuby rescue NameError case lib.to_s when 'nyaplot' Nyaplot.init_script when 'highcharts' LazyHighCharts.init_script when 'googlecharts' GoogleVisualr.init_script when 'datatables' DataTables.init_script else raise ArgumentError, "Unsupported library #{lib}" end end |
.dependent_scripts(libraries = []) ⇒ void, String
Returns dependent script for the libraries.
121 122 123 124 125 126 127 128 129 |
# File 'lib/daru/view.rb', line 121 def dependent_scripts(libraries=[]) load_libs_in_iruby(libraries) if defined? IRuby rescue NameError script = '' libraries.each do |library| script << dependent_script(library) end script end |