In Files

Parent

Log4r::Log4rTools

Some common functions

Public Class Methods

comma_split(string) click to toggle source

Splits comma-delimited lists with arbitrary s padding

# File log4r/base.rb, line 70
    def self.comma_split(string)
      string.split(/\s*,\s*/).collect {|s| s.strip}
    end
decode_bool(hash, symbol, default) click to toggle source

Shortcut for decoding ‘true’, ‘false’, true, false or nil into a bool from a hash parameter. E.g., it looks for true/false values for the keys ‘symbol’ and :symbol.

# File log4r/base.rb, line 59
    def self.decode_bool(hash, symbol, default)
      data = hash[symbol]
      data = hash[symbol.to_s] if data.nil?
      return case data
        when 'true',true then true
        when 'false',false then false
        else default
        end
    end
valid_level?(lev) click to toggle source

(Not documented)

# File log4r/base.rb, line 45
    def self.valid_level?(lev)
      not lev.nil? and lev.kind_of?(Numeric) and lev >= ALL and lev <= OFF
    end
validate_level(level, depth=0) click to toggle source

Raises ArgumentError if level argument is an invalid level. Depth specifies how many trace entries to remove.

# File log4r/base.rb, line 38
    def self.validate_level(level, depth=0)
      unless valid_level?(level)
        raise ArgumentError, "Log level must be in 0..#{LEVELS}",
              caller[1..-(depth + 1)]
      end
    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.