Sha256: b3e2972ac4cd0dbd8e234b339f29d5daef5a200b82e6a72991f7c4667fd8e496

Contents?: true

Size: 575 Bytes

Versions: 7

Compression:

Stored size: 575 Bytes

Contents

# frozen_string_literal: true

require "refinements/pathnames"

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

    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-13.2.1 lib/pragmater/remover.rb
pragmater-13.2.0 lib/pragmater/remover.rb
pragmater-13.1.0 lib/pragmater/remover.rb
pragmater-13.0.3 lib/pragmater/remover.rb
pragmater-13.0.2 lib/pragmater/remover.rb
pragmater-13.0.1 lib/pragmater/remover.rb
pragmater-13.0.0 lib/pragmater/remover.rb