Module: Ego
- Defined in:
- lib/ego.rb,
lib/ego/robot.rb,
lib/ego/plugin.rb,
lib/ego/runner.rb,
lib/ego/handler.rb,
lib/ego/options.rb,
lib/ego/printer.rb,
lib/ego/version.rb,
lib/ego/capability.rb,
lib/ego/filesystem.rb,
lib/ego/robot_error.rb,
lib/ego/plugin_helper.rb
Defined Under Namespace
Modules: Filesystem, Printer Classes: Capability, Handler, Options, Plugin, PluginHelper, Robot, RobotError, Runner
Constant Summary collapse
- VERSION =
Gem version
'0.6.0'
Class Method Summary collapse
-
.plugin(name = nil, &body) ⇒ Plugin
Public interface for defining a plug-in.
Class Method Details
.plugin(name = nil, &body) ⇒ Plugin
Public interface for defining a plug-in.
Ego looks for user-defined plug-ins in $XDG_CONFIG_HOME/ego/plugins/
(that's ~/.config/ego/plugins/ by default), and registers them
automatically at runtime. Each plug-in goes in it's own file with an .rb
extension (e.g., ~/.config/ego/plugins/my_plugin.rb).
Be careful---ego will execute any Ruby scripts in this directory indiscriminately.
35 36 37 38 39 40 41 |
# File 'lib/ego.rb', line 35 def self.plugin(name = nil, &body) path = caller_locations(1, 1)[0].absolute_path name ||= File.basename(path, '.*') builtin = path.start_with?(__dir__) Plugin.register(name, body, builtin: builtin) end |