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



14
15
16
17
18
# File 'lib/eac_cli/runner/class_runner.rb', line 14

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

#runObject



20
21
22
23
24
25
26
27
28
# File 'lib/eac_cli/runner/class_runner.rb', line 20

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



30
31
32
33
# File 'lib/eac_cli/runner/class_runner.rb', line 30

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