class EasyE::Plugin

Attributes

logger[R]
options[R]

Public Class Methods

inherited(klass) click to toggle source
# File lib/easy_e/plugin.rb, line 7
def self.inherited(klass)
  registered_plugins.unshift klass
end
registered_plugins() click to toggle source
# File lib/easy_e/plugin.rb, line 11
def self.registered_plugins
  @@registered_plugins
end

Public Instance Methods

carefully(msg) { || ... } click to toggle source
# File lib/easy_e/plugin.rb, line 39
def carefully msg
  yield
rescue Exception => e
  logger.error "Error while trying to #{msg}"
  logger.error e
  nil
end
collect_options(option_parser) click to toggle source
# File lib/easy_e/plugin.rb, line 27
def collect_options option_parser
  option_parser.on "--#{name.downcase}", "Enable the #{name} plugin" do
    options.enable = true
  end

  defined_options.each do |option_name, description|
    option_parser.on "--#{name.downcase}-#{option_name.to_s.gsub('_','-')} #{option_name.upcase}", description do |val|
      options[option_name.to_sym] = val
    end
  end
end
default_options() click to toggle source
# File lib/easy_e/plugin.rb, line 15
def default_options
  { }
end