Class: HammerCLIForemanTasks::TaskProgress

Inherits:
Object
  • Object
show all
Defined in:
lib/hammer_cli_foreman_tasks/task_progress.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task_id, options = {}, &block) ⇒ TaskProgress

Returns a new instance of TaskProgress.



6
7
8
9
10
11
# File 'lib/hammer_cli_foreman_tasks/task_progress.rb', line 6

def initialize(task_id, options = {}, &block)
  @update_block = block
  @task_id      = task_id
  @interval     = 2
  @options      = options
end

Instance Attribute Details

#intervalObject

Returns the value of attribute interval.



4
5
6
# File 'lib/hammer_cli_foreman_tasks/task_progress.rb', line 4

def interval
  @interval
end

#taskObject

Returns the value of attribute task.



4
5
6
# File 'lib/hammer_cli_foreman_tasks/task_progress.rb', line 4

def task
  @task
end

Instance Method Details

#renderObject



13
14
15
16
# File 'lib/hammer_cli_foreman_tasks/task_progress.rb', line 13

def render
  update_task
  render_progress
end

#success?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/hammer_cli_foreman_tasks/task_progress.rb', line 18

def success?
  !%w(error warning).include?(@task['result'])
end