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



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

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

#runObject



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

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



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

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