Class: Paradeiser::Job

Inherits:
Object
  • Object
show all
Includes:
Executor
Defined in:
lib/paradeiser/models/job.rb

Constant Summary collapse

JOB_PATTERN =
%r|^#{BIN_PAR} .+$|

Constants included from Executor

Executor::BIN_PAR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Executor

#at, #exec, #queue

Constructor Details

#initialize(id) ⇒ Job

Returns a new instance of Job.



9
10
11
# File 'lib/paradeiser/models/job.rb', line 9

def initialize(id)
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/paradeiser/models/job.rb', line 5

def id
  @id
end

Instance Method Details

#==(other) ⇒ Object



13
14
15
# File 'lib/paradeiser/models/job.rb', line 13

def ==(other)
  id == other.id
end

#ours?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
# File 'lib/paradeiser/models/job.rb', line 17

def ours?
  exec("#{at} -c #{@id}")[-2, 2].each do |line|
    if line
      return true if line.chomp.match(JOB_PATTERN)
    end
  end
end