class Pragmater::Inserter

Inserts pragma comments.

Attributes

parser[R]

Public Class Methods

new(parser: Parsers::File.new, **) click to toggle source
Calls superclass method
# File lib/pragmater/inserter.rb, line 12
def initialize(parser: Parsers::File.new, **)
  @parser = parser
  super(**)
end

Public Instance Methods

call() { |path| ... } click to toggle source
# File lib/pragmater/inserter.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: :insert).join
  end
end