Sha256: b4b945208a7ac211f90f379d9dfa22cde96f92b739671bbe14f143385316b6d2

Contents?: true

Size: 463 Bytes

Versions: 50

Compression:

Stored size: 463 Bytes

Contents

# frozen_string_literal: true

module Pragmater
  module Processors
    # Removes existing pragma comments.
    class Remover
      def initialize comments, body
        @comments = comments
        @body = body
      end

      def call
        body.first.then do |first_line|
          body.delete_at 0 if first_line == "\n" && comments.empty?
          comments + body
        end
      end

      private

      attr_reader :comments, :body
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
pragmater-15.7.0 lib/pragmater/processors/remover.rb
pragmater-15.6.0 lib/pragmater/processors/remover.rb
pragmater-15.5.0 lib/pragmater/processors/remover.rb
pragmater-15.4.0 lib/pragmater/processors/remover.rb
pragmater-15.3.0 lib/pragmater/processors/remover.rb
pragmater-15.2.0 lib/pragmater/processors/remover.rb
pragmater-15.1.0 lib/pragmater/processors/remover.rb
pragmater-15.0.0 lib/pragmater/processors/remover.rb
pragmater-14.6.0 lib/pragmater/processors/remover.rb
pragmater-14.4.0 lib/pragmater/processors/remover.rb
pragmater-14.3.0 lib/pragmater/processors/remover.rb
pragmater-14.2.0 lib/pragmater/processors/remover.rb
pragmater-14.1.1 lib/pragmater/processors/remover.rb
pragmater-14.1.0 lib/pragmater/processors/remover.rb
pragmater-14.0.0 lib/pragmater/processors/remover.rb
pragmater-13.2.1 lib/pragmater/processors/remover.rb
pragmater-13.2.0 lib/pragmater/processors/remover.rb
pragmater-13.1.0 lib/pragmater/processors/remover.rb
pragmater-13.0.3 lib/pragmater/processors/remover.rb
pragmater-13.0.2 lib/pragmater/processors/remover.rb