Sha256: 23f5fcdbe1f6a20aff6e4c33bba2e23b0dd8e0996a3757db0214447690374c10

Contents?: true

Size: 781 Bytes

Versions: 16

Compression:

Stored size: 781 Bytes

Contents

class RbVmomi::VIM::Task
  # Wait for a task to finish.
  # @return +info.result+ on success.
  # @raise +info.error+ on error.
  def wait_for_completion
    wait_until('info.state') { %w(success error).member? info.state }
    case info.state
    when 'success'
      info.result
    when 'error'
      raise info.error
    end
  end

  # Wait for a task to finish, with progress notifications.
  # @return (see #wait_for_completion)
  # @raise (see #wait_for_completion)
  # @yield [info.progress]
  def wait_for_progress
    wait_until('info.state', 'info.progress') do
      yield info.progress if block_given?
      %w(success error).member? info.state
    end
    case info.state
    when 'success'
      info.result
    when 'error'
      raise info.error
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rbvmomi-1.5.1 lib/rbvmomi/vim/Task.rb
rbvmomi-1.5.0 lib/rbvmomi/vim/Task.rb
rbvmomi-1.4.0 lib/rbvmomi/vim/Task.rb
rbvmomi-1.3.0 lib/rbvmomi/vim/Task.rb
rbvmomi-1.2.3 lib/rbvmomi/vim/Task.rb
rbvmomi-1.2.2 lib/rbvmomi/vim/Task.rb
rbvmomi-1.2.1 lib/rbvmomi/vim/Task.rb
rbvmomi-1.2.0 lib/rbvmomi/vim/Task.rb
rbvmomi-1.1.8 lib/rbvmomi/vim/Task.rb
rbvmomi-1.1.6 lib/rbvmomi/vim/Task.rb
rbvmomi-1.1.5 lib/rbvmomi/vim/Task.rb
rbvmomi-1.1.4 lib/rbvmomi/vim/Task.rb
rbvmomi-1.1.3 lib/rbvmomi/vim/Task.rb
rbvmomi-1.1.2 lib/rbvmomi/vim/Task.rb
rbvmomi-1.1.1 lib/rbvmomi/vim/Task.rb
rbvmomi-1.1.0 lib/rbvmomi/vim/Task.rb