From 3b0fcbf8baafbb88b2f15631b949fde9c8acff3b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 27 Sep 2009 19:33:21 -0700 Subject: configurator: move initialization stuff to #initialize Avoids making the #listen method any noisier than it should be. --- lib/unicorn/configurator.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb index 114f4fb..a4335b9 100644 --- a/lib/unicorn/configurator.rb +++ b/lib/unicorn/configurator.rb @@ -51,6 +51,9 @@ module Unicorn self.config_file = defaults.delete(:config_file) set.merge!(DEFAULTS) if use_defaults defaults.each { |key, value| self.send(key, value) } + Hash === set[:listener_opts] or + set[:listener_opts] = Hash.new { |hash,key| hash[key] = {} } + Array === set[:listeners] or set[:listeners] = [] reload end @@ -231,8 +234,6 @@ module Unicorn def listen(address, opt = {}) address = expand_addr(address) if String === address - Hash === set[:listener_opts] or - set[:listener_opts] = Hash.new { |hash,key| hash[key] = {} } [ :backlog, :sndbuf, :rcvbuf, :tries ].each do |key| value = opt[key] or next Integer === value or @@ -250,7 +251,6 @@ module Unicorn set[:listener_opts][address].merge!(opt) end - set[:listeners] = [] unless Array === set[:listeners] set[:listeners] << address end -- cgit v1.2.3-24-ge0c7