Class: Laser::Cutter::Launcher

Inherits:
Object
  • Object
show all
Defined in:
lib/laser/cutter/launcher.rb

Overview

Starts the CLI. The executable and the Aruba suite both build one, each with its own argv and streams, and it exits only through kernel.exit.

Instance Method Summary collapse

Constructor Details

#initialize(argv, stdin = $stdin, stdout = $stdout, stderr = $stderr, kernel = Kernel) ⇒ Launcher

Returns a new instance of Launcher.

Parameters:

  • argv (Array<String>) —

    the command line, without the program name

  • stdin (IO) (defaults to: $stdin)
  • stdout (IO) (defaults to: $stdout)
  • stderr (IO) (defaults to: $stderr)
  • kernel (#exit) (defaults to: Kernel) —

    what exits with the status



13
14
15
16
17
18
19
# File 'lib/laser/cutter/launcher.rb', line 13

def initialize(argv, stdin = $stdin, stdout = $stdout, stderr = $stderr, kernel = Kernel)
  @argv = argv
  @stdin = stdin
  @stdout = stdout
  @stderr = stderr
  @kernel = kernel
end

Instance Method Details

#execute! ⇒ void

This method returns an undefined value.

Runs the command line and exits with its status.



24
25
26
# File 'lib/laser/cutter/launcher.rb', line 24

def execute!
  @kernel.exit(run)
end