Class: Pragmater::Processors::Remover
- Inherits:
-
Object
- Object
- Pragmater::Processors::Remover
- Defined in:
- lib/pragmater/processors/remover.rb
Overview
Removes existing pragma comments.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(comments, body) ⇒ Remover
constructor
A new instance of Remover.
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
#call ⇒ Object
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 |