Module: Creeper::Util
- Includes:
- ExceptionHandler
- Included in:
- CLI, Fetcher, Manager, Middleware::Server::RetryJobs, Processor
- Defined in:
- lib/creeper/util.rb
Overview
This module is part of Creeper core and not intended for extensions.
Constant Summary collapse
- EXPIRY =
60 * 60
Instance Method Summary collapse
- #beanstalk(&block) ⇒ Object
- #constantize(camel_cased_word) ⇒ Object
- #logger ⇒ Object
- #process_id ⇒ Object
- #redis(&block) ⇒ Object
- #watchdog(last_words) ⇒ Object
Methods included from ExceptionHandler
Instance Method Details
#beanstalk(&block) ⇒ Object
33 34 35 |
# File 'lib/creeper/util.rb', line 33 def beanstalk(&block) Creeper.beanstalk(&block) end |
#constantize(camel_cased_word) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/creeper/util.rb', line 12 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 |
#process_id ⇒ Object
41 42 43 |
# File 'lib/creeper/util.rb', line 41 def process_id Process.pid end |
#redis(&block) ⇒ Object
37 38 39 |
# File 'lib/creeper/util.rb', line 37 def redis(&block) Creeper.redis(&block) end |
#watchdog(last_words) ⇒ Object
23 24 25 26 27 |
# File 'lib/creeper/util.rb', line 23 def watchdog(last_words) yield rescue => ex handle_exception(ex, { :context => last_words }) end |