Sha256: 3639058fc9c553d901485ea0a1b5c32ef577fd51950cdc3d33465d61603fbe55

Contents?: true

Size: 709 Bytes

Versions: 2

Compression:

Stored size: 709 Bytes

Contents

require "forwardable"

module WarningsLogger
  class Partitioner
    extend Forwardable

    attr_reader :relevant_warning_groups, :irrelevant_warning_groups

    def initialize(configuration:, reader:)
      @configuration = configuration
      @reader = reader
    end

    def partition
      @relevant_warning_groups, @irrelevant_warning_groups =
        warning_groups.partition { |group| relevant_warnings?(group) }
    end

    private

    attr_reader :configuration, :reader

    def_delegators :configuration, :project_directory
    def_delegators :reader, :warning_groups

    def relevant_warnings?(lines_in_group)
      lines_in_group[0].start_with?("#{project_directory}/lib")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
warnings_logger-0.1.1 lib/warnings_logger/partitioner.rb
warnings_logger-0.1.0 lib/warnings_logger/partitioner.rb