Module: TorQML::Plugins
- Defined in:
- lib/torqml/plugins.rb
Overview
TorQML module of plugins
Constant Summary collapse
- VERSION =
Version of Plugins module.
"0.1"
Class Method Summary collapse
-
.default_path ⇒ String
Returns default path of plugin directory.
-
.load(app, dir) ⇒ Object
Loads QML/C++ plugins.
-
.preload(dir) ⇒ Object
Preloads ruby modules of plugins.
Class Method Details
.default_path ⇒ String
Returns default path of plugin directory.
12 13 14 |
# File 'lib/torqml/plugins.rb', line 12 def default_path ENV['HOME'] + '/.torqml/plugins' end |
.load(app, dir) ⇒ Object
Loads QML/C++ plugins.
30 31 32 33 34 35 36 |
# File 'lib/torqml/plugins.rb', line 30 def load(app, dir) Pathname.glob(dir + '*/plugin.rb').each do |path| # add directories into import path of the application app.engine.add_import_path("#{path.realpath.dirname}/qml") if (path.realpath.dirname + 'qml').exist? app.engine.add_import_path("#{path.realpath.dirname}/ext") if (path.realpath.dirname + 'ext').exist? end end |
.preload(dir) ⇒ Object
Preloads ruby modules of plugins.
19 20 21 22 23 24 |
# File 'lib/torqml/plugins.rb', line 19 def preload(dir) Pathname.glob(dir + '*/plugin.rb').each do |path| # load ruby modules require(path.realpath.dirname + path.basename) end end |