class Cri::CommandRunner

A command runner is responsible for the execution of a command. Using it is optional, but it is useful for commands whose execution block is large.

Attributes

arguments[R]

@return [Array] The list of arguments

command[R]

@return [Command] The command

options[R]

@return [Hash] A hash contain the options and their values

Public Class Methods

new(options, arguments, command) click to toggle source

Creates a command runner from the given options, arguments and command.

@param [Hash] options A hash contain the options and their values

@param [Array] arguments The list of arguments

@param [Cri::Command] command The Cri command

# File lib/cri/command_runner.rb, line 23
def initialize(options, arguments, command)
  @options   = options
  @arguments = arguments
  @command   = command
end

Public Instance Methods

call() click to toggle source

Runs the command. By default, this simply does the actual execution, but subclasses may choose to add error handling around the actual execution.

@return [void]

# File lib/cri/command_runner.rb, line 33
def call
  run
end
run() click to toggle source

Performs the actual execution of the command.

@return [void]

@abstract

# File lib/cri/command_runner.rb, line 42
def run
  raise NotImplementedError, 'Cri::CommandRunner subclasses must implement #run'
end