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