Class: Pragmater::Remover

Inherits:
Object
  • Object
show all
Defined in:
lib/pragmater/remover.rb

Overview

Removes pragma comments.

Instance Method Summary collapse

Constructor Details

#initialize(parser: Parsers::File.new) ⇒ Remover

Returns a new instance of Remover.



12
13
14
15
# File 'lib/pragmater/remover.rb', line 12

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

Instance Method Details

#callObject



17
18
19
20
21
22
# File 'lib/pragmater/remover.rb', line 17

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