Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
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.
  • Loading branch information
ekohl authored and bastelfreak committed Jul 12, 2024
commit f2b193dd6ff7a0e0375a3ffaa610cd0727620219
3 changes: 1 addition & 2 deletions lib/puppet/provider/postgresql_conf/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ def parse_config
active_settings = []
# iterate the file and construct a hash for every matching/active setting
# the hash is pushed to the array and the array is returned
File.foreach(resource[:target]).with_index do |line, index|
line_number = index + 1
File.foreach(resource[:target]).with_index(1) do |line, line_number|
matches = line.match(active_values_regex)
if matches
value = if matches[:value].to_i.to_s == matches[:value]
Expand Down