Sha256: 3e9fe0ca8f3287e5b4d99d32d7438874d6331118cb44cd409d3b7ba8fc28774d

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

# Author::    Nicolas Despres  <nicolas.despres@gmail.com>.
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
# License::   LGPL
# $Id: /w/fey/uttk/trunk/lib/uttk/logger/severity.rb 8778 2005-09-26T04:34:48.103938Z ertai  $


module Uttk

  class Logger

    module Severity

      @@labels = %w(DEBUG VERBOSE_INFO INFO WARN ERROR FATAL UNKNOWN)
      @@lower = 0
      @@higher = @@labels.size - 1

      @@labels.each_with_index do |label, i|
        const_set(label, i)
      end

      module_function

      def lower
        @@lower
      end

      def higher
        @@higher
      end

      def unshift(*levels)
        levels.each do |l|
          @@lower -= 1
          const_set(l, @@lower)
          @@labels.unshift(l)
        end
      end

      def push(*levels)
        levels.each do |l|
          @@higher += 1
          const_set(l, @@higher)
          @@labels.push(l)
        end
      end

      # FIXME add the insert method

      def label(level)
        @@labels[level]
      end

      def labels
        @@labels
      end

    end # module Severity

  end # class Logger

end # module Uttk


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uttk-0.4.5.0 lib/uttk/logger/severity.rb
uttk-0.4.6.1 lib/uttk/logger/severity.rb
uttk-0.4.6.2 lib/uttk/logger/severity.rb