aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/configuration_builder.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-07-22 16:55:54 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-07-22 16:55:54 +0100
commit25b32914b72a5f709eca773f3511cc89c2e710c2 (patch)
tree4dab9e78e4c6b49220a837b38d463328c05e2983 /lib/mauve/configuration_builder.rb
parent3185e5d746abda1b7f42ecdbd74ec14359fda3bc (diff)
parentfd23821950f0562a8995735105cd31fdc6d55933 (diff)
merge
Diffstat (limited to 'lib/mauve/configuration_builder.rb')
-rw-r--r--lib/mauve/configuration_builder.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/mauve/configuration_builder.rb b/lib/mauve/configuration_builder.rb
new file mode 100644
index 0000000..fb3c781
--- /dev/null
+++ b/lib/mauve/configuration_builder.rb
@@ -0,0 +1,38 @@
+# encoding: UTF-8
+require 'object_builder'
+require 'mauve/configuration'
+require 'mauve/people_list'
+require 'mauve/source_list'
+
+module Mauve
+ class ConfigurationBuilder < ObjectBuilder
+
+ #
+ # This overwrites the default ObjectBuilder initialize method, such that
+ # the context is set as a new configuration
+ #
+ def initialize
+ @context = @result = Configuration.new
+ # FIXME: need to test blocks that are not immediately evaluated
+ end
+
+ def source_list(label, *list)
+ _logger.warn "Duplicate source_list '#{label}'" if @result.source_lists.has_key?(label)
+ @result.source_lists[label] += list
+ end
+
+ def people_list(label, *list)
+ _logger.warn("Duplicate people_list '#{label}'") if @result.people_lists.has_key?(label)
+ @result.people_lists[label] += list
+ end
+
+ #
+ # Have to use the method _logger here, cos logger is defined as a builder elsewhere.
+ #
+ def _logger
+ @logger ||= Log4r::Logger.new(self.class.to_s)
+ end
+
+ end
+
+end