Method: Guard::PluginUtil#initialize_plugin
- Defined in:
- lib/guard/plugin_util.rb
#initialize_plugin(options) ⇒ Guard::Plugin, Guard::Guard
Initializes a new Guard::Plugin with the given options hash. This methods handles plugins that inherit from the deprecated Guard::Guard class as well as plugins that inherit from Guard::Plugin.
upgrade for Guard 2.0
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/guard/plugin_util.rb', line 55 def initialize_plugin() klass = plugin_class fail "Could not load class: #{_constant_name.inspect}" unless klass if klass.ancestors.include?(Guard) klass.new(.delete(:watchers), ) else begin klass.new(**) rescue ArgumentError => e fail "Failed to call #{klass}.new(options): #{e}" end end end |