class Pluginator::ExtendableAutodetect
Add extendability to Atudetect / Group
@see Autodetect
@see Group
Public Class Methods
new(group, options={})
click to toggle source
Automatically load plugins for given group (and type) Extend instance with extensions if given.
@param group [String] name of the plugins group @param options [Hash] options to pass to creating Pluginator
instance @option type [String] name of type to load @option extends [Array<Symbol>|Symbol] list of extension to extend into pluginator instance
Calls superclass method
Pluginator::Autodetect::new
# File lib/pluginator/extendable_autodetect.rb, line 41 def initialize(group, options={}) super(group, options) extend_plugins(options[:extends] || []) end
Public Instance Methods
extend_plugins(extends)
click to toggle source
Extend pluginator instance with given extensions
@param extends [Array<Symbol>|Symbol] list of extension to extend into pluginator instance
# File lib/pluginator/extendable_autodetect.rb, line 49 def extend_plugins(extends) extensions_matching(extends).each do |plugin| extend plugin end end
Private Instance Methods
extensions_matching(extends)
click to toggle source
# File lib/pluginator/extendable_autodetect.rb, line 65 def extensions_matching(extends) extends = [extends].flatten.map(&:to_s) pluginator_plugins.matching!("extensions", extends) end
pluginator_plugins()
click to toggle source
# File lib/pluginator/extendable_autodetect.rb, line 57 def pluginator_plugins @pluginator_plugins ||= begin plugins = Pluginator::Autodetect.new("pluginator") plugins.extend(Pluginator::Extensions::Matching) plugins end end