class Configuration

This singleton concentrates program options, received from somewhere. Currently, the options are set with the attribute-writer options=(). TODO: Evaluation of a configuration-file. Mind that program-arguments, i.e. the parameter to the options=() setter, must always take precedence !

Attributes

options[R]

Public Class Methods

new() click to toggle source
# File lib/configuration.rb, line 37
def initialize
        init_logger()
        @options = nil
end

Public Instance Methods

method_missing(m, *args) click to toggle source
# File lib/configuration.rb, line 49
def method_missing(m, *args)
        if(@options.respond_to?(m))
                @options.send(m)
        else
                Object.method_missing(m, args)
        end
end
options=(op) click to toggle source
# File lib/configuration.rb, line 57
def options=(op)
        unless @options
                @options = op
                @log.level = @options.debug ? Logger::DEBUG : @def_log_level
                @log.debug('options will be ' << op.to_s)
        else
                # TODO: Think.
                @log.warn('Configuration options are already defined; no changes are applied')
        end
end
to_s() click to toggle source

Exclude that members of the included modules interfer.

# File lib/configuration.rb, line 45
def to_s
        @options.to_h.collect {|p| p[0].to_s << ': ' << p[1].to_s}.join(', ')
end