Class: Guard::Internals::Plugins

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/internals/plugins.rb

Instance Method Summary collapse

Constructor Details

#initializePlugins

Returns a new instance of Plugins.



9
10
11
# File 'lib/guard/internals/plugins.rb', line 9

def initialize
  @plugins = []
end

Instance Method Details

#add(name, options) ⇒ Object

TODO: should it allow duplicates? (probably yes because of different configs or groups)



25
26
27
# File 'lib/guard/internals/plugins.rb', line 25

def add(name, options)
  @plugins << PluginUtil.new(name).initialize_plugin(options)
end

#all(filter = nil) ⇒ Object



13
14
15
16
17
# File 'lib/guard/internals/plugins.rb', line 13

def all(filter = nil)
  return @plugins if filter.nil?
  matcher = matcher_for(filter)
  @plugins.select { |plugin| matcher.call(plugin) }
end

#remove(plugin) ⇒ Object



19
20
21
# File 'lib/guard/internals/plugins.rb', line 19

def remove(plugin)
  @plugins.delete(plugin)
end