Module: Sidecloq::Utils
Defined Under Namespace
Modules: ClassMethods
Classes: ContextLogger
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(klass) ⇒ Object
54
55
56
|
# File 'lib/sidecloq/utils.rb', line 54
def self.included(klass)
klass.extend(ClassMethods)
end
|
Instance Method Details
#logger ⇒ Object
15
16
17
|
# File 'lib/sidecloq/utils.rb', line 15
def logger
@logger ||= ContextLogger.new('Sidecloq')
end
|
#redis(&block) ⇒ Object
19
20
21
|
# File 'lib/sidecloq/utils.rb', line 19
def redis(&block)
self.class.redis(&block)
end
|
#will_never_run(cronline) ⇒ Object
finds cron lines that are impossible, like ‘0 5 31 2 *’ note: does not attempt to fully validate the cronline
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/sidecloq/utils.rb', line 25
def will_never_run(cronline)
split = cronline.split(/\s+/)
if split.length > 3 &&
split[2] =~ /\d+/
split[3] =~ /\d+/
month = split[3].to_i
day = split[2].to_i
return true if month == 2 && day <= 29
return !Date.valid_date?(0, month, day)
else
false
end
end
|