Skip to content

Commit f2b193d

Browse files
ekohlbastelfreak
authored andcommitted
Pass an offset to with_index to calculate line numbers
Rather than starting from 0 and always adding 1, this tells with_index to start at 1.
1 parent 9c5e5ce commit f2b193d

File tree

1 file changed

+1
-2
lines changed
  • lib/puppet/provider/postgresql_conf

1 file changed

+1
-2
lines changed

lib/puppet/provider/postgresql_conf/ruby.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ def parse_config
1919
active_settings = []
2020
# iterate the file and construct a hash for every matching/active setting
2121
# the hash is pushed to the array and the array is returned
22-
File.foreach(resource[:target]).with_index do |line, index|
23-
line_number = index + 1
22+
File.foreach(resource[:target]).with_index(1) do |line, line_number|
2423
matches = line.match(active_values_regex)
2524
if matches
2625
value = if matches[:value].to_i.to_s == matches[:value]

0 commit comments

Comments
 (0)