Class: Ethreadpool::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/threadpool/job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#jobidObject (readonly)

Returns the value of attribute jobid.



4
5
6
# File 'lib/threadpool/job.rb', line 4

def jobid
  @jobid
end

Instance Method Details

#cancelObject



15
16
17
# File 'lib/threadpool/job.rb', line 15

def cancel
  Thread.current.exit
end

#runObject



11
12
13
# File 'lib/threadpool/job.rb', line 11

def run
  p "Running job: #{@jobid}"
end