Sha256: 4ece755d687936093aa61d18b7070344410315927ba00f3f0bb8e9d2aa1d3c89

Contents?: true

Size: 746 Bytes

Versions: 34

Compression:

Stored size: 746 Bytes

Contents

require "plugins/pluginator/extensions/conversions"

module Pluginator::Extensions
  # Extension to find class or first plugin that answers the question with true or to print warning
  module FindCheck
    include Conversions

    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

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

  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
pre-commit-0.40.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.39.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.38.1 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.38.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.37.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.36.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.35.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.34.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.33.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.32.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.31.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.30.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.29.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.28.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.27.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.26.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.25.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.24.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.23.0 lib/plugins/pluginator/extensions/find_check.rb
pre-commit-0.22.1 lib/plugins/pluginator/extensions/find_check.rb