Class: Ethreadpool::Job
- Inherits:
-
Object
- Object
- Ethreadpool::Job
- Defined in:
- lib/threadpool/job.rb
Instance Attribute Summary collapse
-
#jobid ⇒ Object
readonly
Returns the value of attribute jobid.
Instance Method Summary collapse
- #cancel ⇒ Object
-
#initialize(*args) ⇒ Job
constructor
A new instance of Job.
- #run ⇒ Object
Constructor Details
#initialize(*args) ⇒ Job
Returns a new instance of Job.
6 7 8 9 |
# File 'lib/threadpool/job.rb', line 6 def initialize(*args) @args = args @jobid = (0...16).map { ('0'..'9').to_a[rand(9)] }.join end |
Instance Attribute Details
#jobid ⇒ Object (readonly)
Returns the value of attribute jobid.
4 5 6 |
# File 'lib/threadpool/job.rb', line 4 def jobid @jobid end |
Instance Method Details
#cancel ⇒ Object
15 16 17 |
# File 'lib/threadpool/job.rb', line 15 def cancel Thread.current.exit end |
#run ⇒ Object
11 12 13 |
# File 'lib/threadpool/job.rb', line 11 def run p "Running job: #{@jobid}" end |