Class: Orchestration::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/orchestration/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Task


5
6
7
8
9
10
11
# File 'lib/orchestration/task.rb', line 5

def initialize opts
  @name      = opts[:name]
  @status    = opts[:status]
  @priority  = opts[:priority] || 0
  @action    = opts[:action]
  update_ts
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action


3
4
5
# File 'lib/orchestration/task.rb', line 3

def action
  @action
end

#nameObject (readonly)

Returns the value of attribute name


3
4
5
# File 'lib/orchestration/task.rb', line 3

def name
  @name
end

#priorityObject (readonly)

Returns the value of attribute priority


3
4
5
# File 'lib/orchestration/task.rb', line 3

def priority
  @priority
end

#statusObject

Returns the value of attribute status


3
4
5
# File 'lib/orchestration/task.rb', line 3

def status
  @status
end

#timestampObject (readonly)

Returns the value of attribute timestamp


3
4
5
# File 'lib/orchestration/task.rb', line 3

def timestamp
  @timestamp
end

Instance Method Details

#as_json(options = {}) ⇒ Object


26
27
28
# File 'lib/orchestration/task.rb', line 26

def as_json options = {}
  super :only => [:name, :timestamp, :status]
end

#to_sObject


22
23
24
# File 'lib/orchestration/task.rb', line 22

def to_s
  "#{name}\t #{priority}\t #{status}\t #{action}"
end