Sha256: a4d41010fcabcaf6f4074c0baeb9cf0ff247f18422f8c6f5d6f730644f1d3c20

Contents?: true

Size: 568 Bytes

Versions: 8

Compression:

Stored size: 568 Bytes

Contents

# frozen_string_literal: true

require "refinements/pathname"

module Pragmater
  # Removes pragma comments.
  class Remover
    include Import[:settings]

    using Refinements::Pathname

    def initialize(parser: Parsers::File.new, **)
      @parser = parser
      super(**)
    end

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

    private

    attr_reader :parser
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pragmater-15.7.0 lib/pragmater/remover.rb
pragmater-15.6.0 lib/pragmater/remover.rb
pragmater-15.5.0 lib/pragmater/remover.rb
pragmater-15.4.0 lib/pragmater/remover.rb
pragmater-15.3.0 lib/pragmater/remover.rb
pragmater-15.2.0 lib/pragmater/remover.rb
pragmater-15.1.0 lib/pragmater/remover.rb
pragmater-15.0.0 lib/pragmater/remover.rb