Sha256: a8de699924207777e7efbac881d1f132e9fa4b5a3f7053e994df5ee317667bf4
Contents?: true
Size: 574 Bytes
Versions: 7
Compression:
Stored size: 574 Bytes
Contents
# frozen_string_literal: true require "refinements/pathname" module Pragmater # Inserts pragma comments. class Inserter 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: :insert).join end end private attr_reader :parser end end
Version data entries
7 entries across 7 versions & 1 rubygems