From 86b33867b156f9d80bdccf895f16ec0ac3a8a204 Mon Sep 17 00:00:00 2001 From: luke Date: Mon, 16 Oct 2006 02:35:23 +0000 Subject: Adding the ability to have hooks for configuration parameters. This will simplify things like setting the shell path. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1783 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/config.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib') diff --git a/lib/puppet/config.rb b/lib/puppet/config.rb index 8d7b6b895..5725bcd93 100644 --- a/lib/puppet/config.rb +++ b/lib/puppet/config.rb @@ -721,6 +721,10 @@ Generated on #{Time.now}. @desc = value.gsub(/^\s*/, '') end + def hook=(block) + meta_def :handle, &block + end + # Create the new element. Pretty much just sets the name. def initialize(args = {}) if args.include?(:parent) @@ -805,11 +809,16 @@ Generated on #{Time.now}. if respond_to?(:validate) validate(value) end + if respond_to?(:munge) @value = munge(value) else @value = value end + + if respond_to?(:handle) + handle(@value) + end end end -- cgit