Class: ShopifyCLI::ThreadPool::Job
- Inherits:
-
Object
- Object
- ShopifyCLI::ThreadPool::Job
show all
- Defined in:
- lib/shopify_cli/thread_pool/job.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(interval = 0) ⇒ Job
Returns a new instance of Job.
8
9
10
|
# File 'lib/shopify_cli/thread_pool/job.rb', line 8
def initialize(interval = 0)
@interval = interval
end
|
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
6
7
8
|
# File 'lib/shopify_cli/thread_pool/job.rb', line 6
def error
@error
end
|
#interval ⇒ Object
Returns the value of attribute interval.
6
7
8
|
# File 'lib/shopify_cli/thread_pool/job.rb', line 6
def interval
@interval
end
|
Instance Method Details
#call ⇒ Object
16
17
18
19
20
|
# File 'lib/shopify_cli/thread_pool/job.rb', line 16
def call
perform!
rescue StandardError => error
@error = error
end
|
#error? ⇒ Boolean
26
27
28
|
# File 'lib/shopify_cli/thread_pool/job.rb', line 26
def error?
!!@error
end
|
12
13
14
|
# File 'lib/shopify_cli/thread_pool/job.rb', line 12
def perform!
raise "`#{self.class.name}#perform!' must be defined"
end
|
#recurring? ⇒ Boolean
30
31
32
|
# File 'lib/shopify_cli/thread_pool/job.rb', line 30
def recurring?
!interval.zero?
end
|
#success? ⇒ Boolean
22
23
24
|
# File 'lib/shopify_cli/thread_pool/job.rb', line 22
def success?
!@error
end
|