Class: EacCli::Runner::ClassRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_cli/runner/class_runner.rb

Constant Summary collapse

PARSER_ERROR_EXIT_CODE =
1

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
# File 'lib/eac_cli/runner/class_runner.rb', line 10

def create
  r = klass.new
  r.runner_context = ::EacCli::Runner::Context.new(r, *context_args)
  r
end

#runObject



16
17
18
19
20
21
22
23
24
# File 'lib/eac_cli/runner/class_runner.rb', line 16

def run
  r = create
  begin
    r.run_run
  rescue ::EacCli::Parser::Error => e
    run_parser_error(r, e)
  end
  r
end

#run_parser_error(runner_instance, error) ⇒ Object



26
27
28
29
# File 'lib/eac_cli/runner/class_runner.rb', line 26

def run_parser_error(runner_instance, error)
  $stderr.write("#{runner_instance.program_name}: #{error}\n")
  ::Kernel.exit(PARSER_ERROR_EXIT_CODE)
end