Class: Ukiryu::Models::ExitCodes
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Ukiryu::Models::ExitCodes
- Defined in:
- lib/ukiryu/models/exit_codes.rb
Overview
Exit code definitions for tool commands
Provides machine-readable error semantics for exit codes.
Instance Method Summary collapse
-
#all_codes ⇒ Hash
Get all defined exit codes.
-
#custom_codes ⇒ Hash
Get custom exit codes.
-
#defined?(code) ⇒ Boolean
Check if an exit code is defined.
-
#meaning(code) ⇒ String?
Get the meaning of an exit code.
-
#standard_codes ⇒ Hash
Get standard exit codes.
-
#success?(code) ⇒ Boolean
Check if an exit code indicates success.
Instance Method Details
#all_codes ⇒ Hash
Get all defined exit codes
53 54 55 |
# File 'lib/ukiryu/models/exit_codes.rb', line 53 def all_codes @standard.to_h.merge(@custom.to_h) end |
#custom_codes ⇒ Hash
Get custom exit codes
67 68 69 |
# File 'lib/ukiryu/models/exit_codes.rb', line 67 def custom_codes @custom.to_h end |
#defined?(code) ⇒ Boolean
Check if an exit code is defined
38 39 40 |
# File 'lib/ukiryu/models/exit_codes.rb', line 38 def defined?(code) !meaning(code).nil? end |
#meaning(code) ⇒ String?
Get the meaning of an exit code
27 28 29 30 31 32 |
# File 'lib/ukiryu/models/exit_codes.rb', line 27 def meaning(code) code_str = code.to_s # Check custom codes first (more specific) @custom&.dig(code_str) || @standard&.dig(code_str) end |
#standard_codes ⇒ Hash
Get standard exit codes
60 61 62 |
# File 'lib/ukiryu/models/exit_codes.rb', line 60 def standard_codes @standard.to_h end |
#success?(code) ⇒ Boolean
Check if an exit code indicates success
46 47 48 |
# File 'lib/ukiryu/models/exit_codes.rb', line 46 def success?(code) code.zero? || meaning(code) == 'success' end |