class Simulacrum::CLI::Command

Class for wrappin up logic for running the process and handling exit

Public Class Methods

new(argv, stdin = $stdin, stdout = $stdout, stderr = $stderr, kernel = Kernel) click to toggle source
# File lib/simulacrum/cli.rb, line 14
def initialize(argv, stdin = $stdin, stdout = $stdout, stderr = $stderr, kernel = Kernel)
  @argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
end

Public Instance Methods

run_and_exit() click to toggle source
# File lib/simulacrum/cli.rb, line 18
def run_and_exit
  @exit_code = run
  @kernel.exit(@exit_code)
end

Private Instance Methods

parsed_argv() click to toggle source
# File lib/simulacrum/cli.rb, line 33
def parsed_argv
  @parsed_argv ||= CLI::Parser.parse(@argv)
end
run() click to toggle source
# File lib/simulacrum/cli.rb, line 25
def run
  if parsed_argv == true
    0
  else
    Simulacrum.run(parsed_argv)
  end
end