Module: Pluginator::Extensions::FindCheck

Includes:
Conversions
Defined in:
lib/plugins/pluginator/extensions/find_check.rb

Overview

Extension to find class or first plugin that answers the question with true or to print warning

Instance Method Summary collapse

Instance Method Details

#available_pluginsObject



21
22
23
# File 'lib/plugins/pluginator/extensions/find_check.rb', line 21

def available_plugins
  @plugins["checks"].map{|plugin| class2name(plugin) }.join(", ")
end

#find_check(name) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/plugins/pluginator/extensions/find_check.rb', line 8

def find_check(name)
  klass = string2class(name)
  @plugins["checks"].detect do |plugin|
    class2name(plugin) == klass ||
    plugin.respond_to?(:aliases) && plugin.public_send(:aliases).include?(name.to_sym)
  end ||
  begin
    $stderr.puts "Could not find plugin supporting #{name} / #{klass},
available plugins: #{available_plugins}"
    nil
  end
end