Class: Pragmater::Processors::Inserter
- Inherits:
-
Object
- Object
- Pragmater::Processors::Inserter
- Defined in:
- lib/pragmater/processors/inserter.rb
Overview
Inserts new pragma comments.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(comments, body) ⇒ Inserter
constructor
A new instance of Inserter.
Constructor Details
#initialize(comments, body) ⇒ Inserter
Returns a new instance of Inserter.
7 8 9 10 |
# File 'lib/pragmater/processors/inserter.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/inserter.rb', line 12 def call body.first.then do |first| comments.append "\n" unless first == "\n" || body.empty? comments + body end end |