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-9.3.0 lib/pragmater/processors/remover.rb
pragmater-9.2.0 lib/pragmater/processors/remover.rb
pragmater-9.1.2 lib/pragmater/processors/remover.rb
pragmater-9.1.1 lib/pragmater/processors/remover.rb
pragmater-9.1.0 lib/pragmater/processors/remover.rb
pragmater-9.0.0 lib/pragmater/processors/remover.rb
pragmater-8.3.0 lib/pragmater/processors/remover.rb
pragmater-8.2.0 lib/pragmater/processors/remover.rb
pragmater-8.1.0 lib/pragmater/processors/remover.rb
pragmater-8.0.0 lib/pragmater/processors/remover.rb