Class: Pragmater::Processors::Remover

Inherits:
Object
  • Object
show all
Defined in:
lib/pragmater/processors/remover.rb

Overview

Removes existing pragma comments.

Instance Method Summary collapse

Constructor Details

#initialize(comments, body) ⇒ Remover

Returns a new instance of Remover.



7
8
9
10
# File 'lib/pragmater/processors/remover.rb', line 7

def initialize comments, body
  @comments = comments
  @body = body
end

Instance Method Details

#callObject



12
13
14
15
16
17
# File 'lib/pragmater/processors/remover.rb', line 12

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