Module: Chore::Util

Included in:
Chore, CLI, Job, Manager, Strategy::ForkedWorkerStrategy, Strategy::PreforkedWorker, Worker
Defined in:
lib/chore/util.rb

Overview

Collection of utilities and helpers used by Chore internally

Instance Method Summary collapse

Instance Method Details

#constantize(camel_cased_word) ⇒ Object

To avoid bringing in all of active_support, we implemented constantize here



7
8
9
10
11
12
13
14
15
16
# File 'lib/chore/util.rb', line 7

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

#procline(str) ⇒ Object



18
19
20
# File 'lib/chore/util.rb', line 18

def procline(str)
  $0 = str
end