Class: Puppet::Cleaner::OctalMode

Inherits:
Worker
  • Object
show all
Defined in:
lib/puppet-cleaner/workers/octalmode.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/octalmode.rb', line 7

def operate(line)
  prev = line.prev.name == :BLANK ? line.prev(2) : line.prev
  return if prev.value != "mode"
  pos = line.next.name == :BLANK ? line.position + 2 : line.position + 1
  mode = line.parts[pos]
  
  if mode.value =~ /^0?[0-7]{1,4}$/
    line.parts[pos] = Part.create([:STRING, {:value => mode.value.rjust(4, "0")}])
  end
end

#part_namesObject



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

def part_names
  [:FARROW]
end