Sha256: fed3b338490b8e3a81040a080f7a7b6769701ca03a6120605bdf447e83687acd

Contents?: true

Size: 573 Bytes

Versions: 7

Compression:

Stored size: 573 Bytes

Contents

# frozen_string_literal: true

require "refinements/pathname"

module Pragmater
  # Removes pragma comments.
  class Remover
    using Refinements::Pathname

    def initialize parser: Parsers::File.new
      @parser = parser
    end

    def call configuration = Container[:configuration]
      Pathname(configuration.root_dir).files("{#{configuration.patterns.join ","}}").map do |path|
        yield path if block_given?
        path.write parser.call(path, configuration.comments, action: :remove).join
      end
    end

    private

    attr_reader :parser
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pragmater-14.6.0 lib/pragmater/remover.rb
pragmater-14.4.0 lib/pragmater/remover.rb
pragmater-14.3.0 lib/pragmater/remover.rb
pragmater-14.2.0 lib/pragmater/remover.rb
pragmater-14.1.1 lib/pragmater/remover.rb
pragmater-14.1.0 lib/pragmater/remover.rb
pragmater-14.0.0 lib/pragmater/remover.rb