Sha256: a8fef75a633e4de3f64140e09cbf1c3ded4b461a3d151b706a11c032e84538b4

Contents?: true

Size: 953 Bytes

Versions: 13

Compression:

Stored size: 953 Bytes

Contents

module Koala
  module Utils

    # Utility methods used by Koala.
    require 'logger'
    require 'forwardable'

    extend Forwardable
    extend self

    def_delegators :logger, :debug, :info, :warn, :error, :fatal, :level, :level=

    # The Koala logger, an instance of the standard Ruby logger, pointing to STDOUT by default.
    # In Rails projects, you can set this to Rails.logger.
    attr_accessor :logger
    self.logger = Logger.new(STDOUT)
    self.logger.level = Logger::ERROR

    # @private
    DEPRECATION_PREFIX = "KOALA: Deprecation warning: "

    # Prints a deprecation message.
    # Each individual message will only be printed once to avoid spamming.
    def deprecate(message)
      @posted_deprecations ||= []
      unless @posted_deprecations.include?(message)
        # only include each message once
        Kernel.warn("#{DEPRECATION_PREFIX}#{message}")
        @posted_deprecations << message
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
koala-1.10.1 lib/koala/utils.rb
koala-1.10.0 lib/koala/utils.rb
koala-1.10.0rc2 lib/koala/utils.rb
koala-1.10.0rc lib/koala/utils.rb
koala-1.9.0 lib/koala/utils.rb
koala-1.9.0rc1 lib/koala/utils.rb
koala-1.8.0 lib/koala/utils.rb
koala-1.8.0rc1 lib/koala/utils.rb
koala-1.7.0rc1 lib/koala/utils.rb
koala-1.6.0 lib/koala/utils.rb
koala-1.6.0.rc1 lib/koala/utils.rb
koala-1.5.0 lib/koala/utils.rb
koala-1.5.0rc1 lib/koala/utils.rb