Sha256: be967cf6aadaa5792e196c6bf00ee002d9f0400fe27d7f918af918c5ea6b1361

Contents?: true

Size: 706 Bytes

Versions: 2

Compression:

Stored size: 706 Bytes

Contents

module Sidekiq
  module Util

    def constantize(camel_cased_word)
      names = camel_cased_word.split('::')
      names.shift if names.empty? || names.first.empty?

      constant = Object
      names.each do |name|
        constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
      end
      constant
    end

    def watchdog(last_words)
      yield
    rescue => ex
      STDERR.puts last_words
      STDERR.puts ex
      STDERR.puts ex.backtrace.join("\n")
    end

    def err(msg)
      STDERR.puts(msg)
    end

    def log(msg)
      STDOUT.puts(msg) unless $TESTING
    end

    def verbose(msg)
      STDOUT.puts(msg) if $DEBUG
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq-0.5.1 lib/sidekiq/util.rb
sidekiq-0.5.0 lib/sidekiq/util.rb