Class: Guard::Internals::Plugins
- Inherits:
-
Object
- Object
- Guard::Internals::Plugins
- Defined in:
- lib/guard/internals/plugins.rb
Instance Method Summary collapse
-
#add(name, options) ⇒ Object
TODO: should it allow duplicates? (probably yes because of different configs or groups).
- #all(filter = nil) ⇒ Object
-
#initialize ⇒ Plugins
constructor
A new instance of Plugins.
- #remove(plugin) ⇒ Object
Constructor Details
#initialize ⇒ Plugins
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, ) @plugins << PluginUtil.new(name).initialize_plugin() 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 |