Class: Colonel::Job

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schedule, command) ⇒ Job

Returns a new instance of Job.



6
7
8
9
10
11
12
# File 'lib/colonel/job.rb', line 6

def initialize(schedule, command)
  @schedule = schedule
  @command = command

  increase_amount
  @id = @@amount
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



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

def command
  @command
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#scheduleObject (readonly)

Returns the value of attribute schedule.



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

def schedule
  @schedule
end

Class Method Details

.clear_amountObject



14
15
16
# File 'lib/colonel/job.rb', line 14

def self.clear_amount
  @@amount = 0
end

Instance Method Details

#update(opts = {}) ⇒ Object



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

def update(opts={})
  @schedule = Parser::Schedule.new(opts[:schedule])
  @command  = Parser::Command.new(opts[:command])

  self
end