Class: HastCI::TaskResult

Inherits:
Object
  • Object
show all
Defined in:
lib/hastci/task_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task_id:, status:, duration_s:, logs:) ⇒ TaskResult

Returns a new instance of TaskResult.



7
8
9
10
11
12
13
# File 'lib/hastci/task_result.rb', line 7

def initialize(task_id:, status:, duration_s:, logs:)
  @task_id = task_id
  @status = status
  @duration_s = duration_s
  @logs = logs
  freeze
end

Instance Attribute Details

#duration_sObject (readonly)

Returns the value of attribute duration_s.



5
6
7
# File 'lib/hastci/task_result.rb', line 5

def duration_s
  @duration_s
end

#logsObject (readonly)

Returns the value of attribute logs.



5
6
7
# File 'lib/hastci/task_result.rb', line 5

def logs
  @logs
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/hastci/task_result.rb', line 5

def status
  @status
end

#task_idObject (readonly)

Returns the value of attribute task_id.



5
6
7
# File 'lib/hastci/task_result.rb', line 5

def task_id
  @task_id
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



23
24
25
26
27
28
29
# File 'lib/hastci/task_result.rb', line 23

def ==(other)
  other.is_a?(TaskResult) &&
    other.task_id == task_id &&
    other.status == status &&
    other.duration_s == duration_s &&
    other.logs == logs
end

#failed?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/hastci/task_result.rb', line 19

def failed?
  status == :failed
end

#hashObject



33
34
35
# File 'lib/hastci/task_result.rb', line 33

def hash
  [task_id, status, duration_s, logs].hash
end

#passed?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/hastci/task_result.rb', line 15

def passed?
  status == :passed
end