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, &block) ⇒ TaskProgress

Returns a new instance of TaskProgress.



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

def initialize(task_id, &block)
  @update_block = block
  @task_id      = task_id
  @interval     = 2
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



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

def render
  update_task
  render_progress
end

#success?Boolean

Returns:

  • (Boolean)


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

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