Class: PDK::CLI::ExecGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/pdk/cli/exec_group.rb

Direct Known Subclasses

ParallelExecGroup, SerialExecGroup

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_message, opts = {}) ⇒ ExecGroup

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Base class for an Exection Group



31
32
33
# File 'lib/pdk/cli/exec_group.rb', line 31

def initialize(_message, opts = {})
  @options = opts
end

Class Method Details

.create(message, create_options = {}, group_opts = {}) ⇒ ExecGroup

Execution Group (ExecGroup) factory.

Options Hash (create_options):

  • :parallel (Boolean)

    Whether the group should be executed in Parallel (True) or Serial (False)



16
17
18
19
20
21
22
# File 'lib/pdk/cli/exec_group.rb', line 16

def self.create(message, create_options = {}, group_opts = {})
  if create_options[:parallel]
    ParallelExecGroup.new(message, group_opts)
  else
    SerialExecGroup.new(message, group_opts)
  end
end

Instance Method Details

#exit_codeint

This method is abstract.

The return code of running all registered blocks



49
# File 'lib/pdk/cli/exec_group.rb', line 49

def exit_code; end

#register(&_block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Register something to execute as a group



40
41
42
# File 'lib/pdk/cli/exec_group.rb', line 40

def register(&_block)
  raise PDK::CLI::FatalError, 'No block registered' unless block_given?
end