summaryrefslogtreecommitdiff
path: root/lib/puppet/util/ini_file/section.rb
diff options
context:
space:
mode:
authorChris Price <chris@puppetlabs.com>2012-10-17 15:50:02 -0700
committerChris Price <chris@puppetlabs.com>2012-10-17 15:50:02 -0700
commita5eebcfca0c1c8e8fb8130205a6ec623c8691326 (patch)
tree17a5bb35c8861a745786105eeaee2e7d8479e711 /lib/puppet/util/ini_file/section.rb
parent842b2f06b2d8bcd8a8e7ed00b2d388bc4ddf1db2 (diff)
parentcda30a6ab9b6fa673ead091ab0b130cbc6e75dbc (diff)
downloadpuppet-inifile-a5eebcfca0c1c8e8fb8130205a6ec623c8691326.tar.gz
puppet-inifile-a5eebcfca0c1c8e8fb8130205a6ec623c8691326.tar.bz2
Merge pull request #18 from cprice-puppet/feature/master/tweaks-to-setting-removal
Feature/master/tweaks to setting removal
Diffstat (limited to 'lib/puppet/util/ini_file/section.rb')
-rw-r--r--lib/puppet/util/ini_file/section.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/puppet/util/ini_file/section.rb b/lib/puppet/util/ini_file/section.rb
index 39f2959..16f19d3 100644
--- a/lib/puppet/util/ini_file/section.rb
+++ b/lib/puppet/util/ini_file/section.rb
@@ -24,11 +24,31 @@ class IniFile
@existing_settings[setting_name] = value
end
+ def remove_existing_setting(setting_name)
+ if (@existing_settings.delete(setting_name))
+ if @end_line
+ @end_line = @end_line - 1
+ end
+ end
+ end
+
def set_additional_setting(setting_name, value)
@additional_settings[setting_name] = value
end
+ # Decrement the start and end line numbers for the section (if they are
+ # defined); this is intended to be called when a setting is removed
+ # from a section that comes before this section in the ini file.
+ def decrement_line_nums()
+ if @start_line
+ @start_line = @start_line - 1
+ end
+ if @end_line
+ @end_line = @end_line - 1
+ end
+ end
+
end
end
end
-end \ No newline at end of file
+end