Sha256: ce7ff32715cf4ce89579b4f7f6856ef1761959aa7220cba74b32042d91059f4b

Contents?: true

Size: 953 Bytes

Versions: 97

Compression:

Stored size: 953 Bytes

Contents

module CC
  class Config
    class EngineSet
      attr_reader :engines

      def initialize(data)
        @data = data
        @engines = []

        build_set
      end

      private

      attr_reader :data

      def build_set
        DefaultAdapter::ENGINES.keys.each do |name|
          if (engine = extract_engine(name))
            engines << engine
          end
        end

        data.each do |name, engine_data|
          engines << build_engine(name, engine_data)
        end
      end

      def extract_engine(name)
        if data[name]
          engine_data = data.delete(name)
          build_engine(name, engine_data)
        end
      end

      def build_engine(name, data)
        Config::Engine.new(
          name,
          enabled: data.fetch("enabled", true),
          channel: data["channel"],
          config: data,
          exclude_patterns: data.fetch("exclude_patterns", []),
        )
      end
    end
  end
end

Version data entries

97 entries across 97 versions & 2 rubygems

Version Path
codeclimate-0.85.27 lib/cc/config/engine_set.rb
codeclimate-0.85.26 lib/cc/config/engine_set.rb
codeclimate-0.85.25 lib/cc/config/engine_set.rb
codeclimate-0.85.24 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.54 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.53 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.52 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.51 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.50 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.49 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.48 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.47 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.46 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.45 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.44 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.43 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.42 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.41 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.40 lib/cc/config/engine_set.rb
codeclimate-fede-0.85.39 lib/cc/config/engine_set.rb