Class: Epi::Daemon::Responders::Job

Inherits:
Epi::Daemon::Responder show all
Defined in:
lib/epi/daemon/responders/job.rb

Instance Attribute Summary collapse

Attributes inherited from Epi::Daemon::Responder

#receiver

Instance Method Summary collapse

Methods inherited from Epi::Daemon::Responder

#done, #initialize, #logger, #puts, run

Constructor Details

This class inherits a constructor from Epi::Daemon::Responder

Instance Attribute Details

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/epi/daemon/responders/job.rb', line 6

def id
  @id
end

#instructionObject

Returns the value of attribute instruction.



6
7
8
# File 'lib/epi/daemon/responders/job.rb', line 6

def instruction
  @instruction
end

Instance Method Details

#runObject

Raises:



8
9
10
11
12
13
14
15
16
# File 'lib/epi/daemon/responders/job.rb', line 8

def run
  Jobs.beat!
  raise Exceptions::Fatal, 'Unknown job ID' unless Epi::Job === job
  case instruction
    when /^\d+$/ then set instruction.to_i
    when /^(\d+ )?(more|less)$/ then __send__ $2, ($1 || 1).to_i
    else __send__ instruction
  end
end