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 9 10 11 12 |
# File 'lib/daru/view/adapters/nyaplot/iruby_notebook.rb', line 3 def self.generate_init_code_offline(dependent_js) js_dir = File.( '../../../../../vendor/assets/javascripts/nyaplot', __dir__ ) path = File.( '../../templates/nyaplot/init.inline.js.erb', __dir__ ) template = File.read(path) ERB.new(template).result(binding) end |
.generate_init_code_online ⇒ Object
generate initializing code
15 16 17 |
# File 'lib/daru/view/adapters/nyaplot/iruby_notebook.rb', line 15 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
20 21 22 23 24 25 |
# File 'lib/daru/view/adapters/nyaplot/iruby_notebook.rb', line 20 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', __dir__) template = File.read(path) ERB.new(template).result(binding) end |