Class: FluidCLI::ThreadPool::Job
- Inherits:
-
Object
- Object
- FluidCLI::ThreadPool::Job
- Defined in:
- lib/fluid_cli/thread_pool/job.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#interval ⇒ Object
readonly
Returns the value of attribute interval.
Instance Method Summary collapse
- #call ⇒ Object
- #error? ⇒ Boolean
-
#initialize(interval = 0) ⇒ Job
constructor
A new instance of Job.
- #perform! ⇒ Object
- #recurring? ⇒ Boolean
- #success? ⇒ Boolean
Constructor Details
#initialize(interval = 0) ⇒ Job
Returns a new instance of Job.
8 9 10 |
# File 'lib/fluid_cli/thread_pool/job.rb', line 8 def initialize(interval = 0) @interval = interval end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
6 7 8 |
# File 'lib/fluid_cli/thread_pool/job.rb', line 6 def error @error end |
#interval ⇒ Object (readonly)
Returns the value of attribute interval.
6 7 8 |
# File 'lib/fluid_cli/thread_pool/job.rb', line 6 def interval @interval end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 |
# File 'lib/fluid_cli/thread_pool/job.rb', line 16 def call perform! rescue StandardError => error @error = error end |
#error? ⇒ Boolean
26 27 28 |
# File 'lib/fluid_cli/thread_pool/job.rb', line 26 def error? !!@error end |
#perform! ⇒ Object
12 13 14 |
# File 'lib/fluid_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/fluid_cli/thread_pool/job.rb', line 30 def recurring? !interval.zero? end |
#success? ⇒ Boolean
22 23 24 |
# File 'lib/fluid_cli/thread_pool/job.rb', line 22 def success? !@error end |