1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
mperham--sidekiq/lib/sidekiq/util.rb
Mike Perham 4cc5514755 Cleanup
2012-09-16 07:27:49 -07:00

45 lines
877 B
Ruby

require 'sidekiq/exception_handler'
module Sidekiq
##
# This module is part of Sidekiq core and not intended for extensions.
#
module Util
include ExceptionHandler
EXPIRY = 60 * 60 * 24
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 Exception => ex
handle_exception(ex, { :context => last_words })
end
def logger
Sidekiq.logger
end
def redis(&block)
Sidekiq.redis(&block)
end
def process_id
Process.pid
end
def hostname
Socket.gethostname
end
end
end