Method: ReliableMsg::Config#initialize

Defined in:
lib/reliable-msg/queue-manager.rb

#initialize(file, logger = nil) ⇒ Config

Returns a new instance of Config.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/reliable-msg/queue-manager.rb', line 46

def initialize file, logger = nil
    @logger = logger
    # If no file specified, attempt to look for file in current directory.

    # If not found in current directory, look for file in Gem directory.

    unless file
        file = if File.exist?(CONFIG_FILE)
            CONFIG_FILE
        else
            file = File.expand_path(File.join(File.dirname(__FILE__), '..'))
            File.basename(file) == 'lib' ? File.join(file, '..', CONFIG_FILE) : File.join(file, CONFIG_FILE)
        end
    end
    @file = File.expand_path(file)
    @config = {}
end