Module: Nyaplot
- Defined in:
- lib/daru/view/adapters/nyaplot/display.rb,
lib/daru/view/adapters/nyaplot/iruby_notebook.rb
Class Method Summary collapse
-
.generate_init_code_offline(dependent_js) ⇒ Object
generate initializing code.
-
.generate_init_code_online ⇒ Object
generate initializing code.
-
.init_iruby ⇒ Object
Enable to show plots on IRuby notebook.
-
.init_script ⇒ Object
dependent JS to include in head tag of the web application.
Class Method Details
.generate_init_code_offline(dependent_js) ⇒ Object
generate initializing code
3 4 5 6 7 8 |
# File 'lib/daru/view/adapters/nyaplot/iruby_notebook.rb', line 3 def self.generate_init_code_offline(dependent_js) js_dir = File.('../../js/nyaplot_js', __FILE__) path = File.('../../../templates/nyaplot/init.inline.js.erb', __FILE__) template = File.read(path) ERB.new(template).result(binding) end |
.generate_init_code_online ⇒ Object
generate initializing code
11 12 13 |
# File 'lib/daru/view/adapters/nyaplot/iruby_notebook.rb', line 11 def self.generate_init_code_online # TODO : better than present Nyaplot.generate_init_code end |
.init_iruby ⇒ Object
Enable to show plots on IRuby notebook
16 17 18 19 20 21 |
# File 'lib/daru/view/adapters/nyaplot/iruby_notebook.rb', line 16 def self.init_iruby(*) # # dependent_js=['d3.min.js', 'd3-downloadable.js', 'nyaplot.js'] js = generate_init_code IRuby.display(IRuby.javascript(js)) end |
.init_script ⇒ Object
dependent JS to include in head tag of the web application
3 4 5 6 7 8 |
# File 'lib/daru/view/adapters/nyaplot/display.rb', line 3 def self.init_script init = Nyaplot.generate_init_code path = File.('../../../templates/nyaplot/init_script.erb', __FILE__) template = File.read(path) ERB.new(template).result(binding) end |