Class: Puppet::Cleaner::MultilineComments

Inherits:
Worker
  • Object
show all
Defined in:
lib/puppet-cleaner/workers/multilinecomments.rb

Instance Method Summary collapse

Methods inherited from Worker

#get_param

Instance Method Details

#operate(line) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/puppet-cleaner/workers/multilinecomments.rb', line 7

def operate(line)
  pos = line.position
  comments = line.current.value.split("\n")
  line.remove(pos)
  comments.map! do |comment|
    [Part.create([:COMMENT, {:value => comment}]),
     Part.create([:RETURN, {:value => "\n"}])]
  end
  line.insert(pos, comments.flatten)
end

#part_namesObject



3
4
5
# File 'lib/puppet-cleaner/workers/multilinecomments.rb', line 3

def part_names
  [:MLCOMMENT]
end