Module: EacCli::Runner::InstanceMethods
- Defined in:
- lib/eac_cli/runner/instance_methods.rb
Constant Summary collapse
- PARSER_ERROR_EXIT_CODE =
1
Instance Method Summary collapse
- #parsed ⇒ Object
- #run_parser_error(error) ⇒ Object
- #run_run ⇒ Object
- #runner_context ⇒ Object
- #runner_context=(new_runner_context) ⇒ Object
Instance Method Details
#parsed ⇒ Object
33 34 35 |
# File 'lib/eac_cli/runner/instance_methods.rb', line 33 def parsed @parsed ||= ::EacCli::Parser.new(self.class.runner_definition, runner_context.argv).parsed end |
#run_parser_error(error) ⇒ Object
17 18 19 20 |
# File 'lib/eac_cli/runner/instance_methods.rb', line 17 def run_parser_error(error) $stderr.write("#{error}\n") ::Kernel.exit(PARSER_ERROR_EXIT_CODE) end |
#run_run ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/eac_cli/runner/instance_methods.rb', line 8 def run_run parsed run_callbacks(:run) { run } rescue ::EacCli::Parser::Error => e run_parser_error(e) rescue ::EacCli::Runner::Exit # rubocop:disable Lint/SuppressedException # Do nothing end |
#runner_context ⇒ Object
22 23 24 25 26 |
# File 'lib/eac_cli/runner/instance_methods.rb', line 22 def runner_context return @runner_context if @runner_context raise 'Context was required, but was not set yet' end |
#runner_context=(new_runner_context) ⇒ Object
28 29 30 31 |
# File 'lib/eac_cli/runner/instance_methods.rb', line 28 def runner_context=(new_runner_context) @runner_context = new_runner_context @parsed = nil end |