Sha256: 7dcf31cd04543b869b25cf352dac5784191c3dd09c955d7fd9eec1aaeea60889

Contents?: true

Size: 575 Bytes

Versions: 6

Compression:

Stored size: 575 Bytes

Contents

module CaptainHoog
  class PluginList

    attr_reader :plugins

    def initialize(type='pre-commit', config: {})
      @config = config
      @type   = type
      build_list
    end

    def has?(plugin)
      @plugins.include?(plugin.plugin_name)
    end

    private

    def build_list
      plugins_for_type = @config.fetch(@type, [])
      excluded_plugins = @config.fetch('exclude', [])

      plugins_for_type = [] if plugins_for_type.nil?
      excluded_plugins = [] if excluded_plugins.nil?

      @plugins = plugins_for_type - excluded_plugins
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
captain_hoog-2.0.0 lib/captain_hoog/plugin_list.rb
captain_hoog-1.1.1 lib/captain_hoog/plugin_list.rb
captain_hoog-1.1.0 lib/captain_hoog/plugin_list.rb
captain_hoog-1.0.2 lib/captain_hoog/plugin_list.rb
captain_hoog-1.0.1 lib/captain_hoog/plugin_list.rb
captain_hoog-1.0 lib/captain_hoog/plugin_list.rb