Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added method dependent_scripts #107

Merged
merged 5 commits into from Jul 29, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rubocop.yml
Expand Up @@ -17,7 +17,7 @@ AllCops:
- 'daru-view.gemspec'
- '**/*.rake'
DisplayCopNames: true
TargetRubyVersion: 2.1
TargetRubyVersion: 2.2

# Preferred codebase style ---------------------------------------------
Layout/ExtraSpacing:
Expand Down
11 changes: 11 additions & 0 deletions lib/daru/view.rb
Expand Up @@ -68,6 +68,17 @@ def table_library=(lib)
end
end

# @param libraries [Array] Adapters whose JS files will be loaded
# @return [void] load the dependent JS files for the adapter
# @example
# To load the dependent JS file for Nyaplot and GoogleCharts libraries
# Daru::View.load_libs_in_iruby(['nyaplot','googlecharts'])
def load_libs_in_iruby(libraries=[])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use the dependent_script method to load js in iruby as well as web frameworks.
We can check for IRuby and accordingly load js .

libraries.each do |library|
load_lib_in_iruby(library.to_s)
end
end

# Load the dependent JS files in IRuby notebook. Those JS will help in
# plotting the charts in IRuby cell.
#
Expand Down