Class: Ukiryu::Models::ExecutableInfo
- Inherits:
-
Object
- Object
- Ukiryu::Models::ExecutableInfo
- Defined in:
- lib/ukiryu/models/executable_info.rb
Overview
Information about how an executable was discovered
Provides transparency about tool discovery - whether the executable was found in PATH or is a shell alias, which shell was used, and the alias definition if applicable.
Instance Attribute Summary collapse
-
#alias_definition ⇒ String?
readonly
The alias definition if source is :alias.
-
#path ⇒ String
readonly
The full path to the executable.
-
#shell ⇒ Symbol
readonly
The shell used for discovery.
-
#source ⇒ Symbol
readonly
How the executable was discovered.
Instance Method Summary collapse
-
#alias? ⇒ Boolean
Check if this is a shell alias.
-
#description ⇒ String
Human-readable description.
-
#initialize(path:, source:, shell:, alias_definition: nil) ⇒ ExecutableInfo
constructor
A new instance of ExecutableInfo.
-
#path? ⇒ Boolean
Check if this was found in PATH.
Constructor Details
#initialize(path:, source:, shell:, alias_definition: nil) ⇒ ExecutableInfo
Returns a new instance of ExecutableInfo.
46 47 48 49 50 51 |
# File 'lib/ukiryu/models/executable_info.rb', line 46 def initialize(path:, source:, shell:, alias_definition: nil) @path = path @source = source @shell = shell @alias_definition = alias_definition end |
Instance Attribute Details
#alias_definition ⇒ String? (readonly)
The alias definition if source is :alias
44 45 46 |
# File 'lib/ukiryu/models/executable_info.rb', line 44 def alias_definition @alias_definition end |
#path ⇒ String (readonly)
The full path to the executable
29 30 31 |
# File 'lib/ukiryu/models/executable_info.rb', line 29 def path @path end |
#shell ⇒ Symbol (readonly)
The shell used for discovery
39 40 41 |
# File 'lib/ukiryu/models/executable_info.rb', line 39 def shell @shell end |
#source ⇒ Symbol (readonly)
How the executable was discovered
34 35 36 |
# File 'lib/ukiryu/models/executable_info.rb', line 34 def source @source end |
Instance Method Details
#alias? ⇒ Boolean
Check if this is a shell alias
68 69 70 |
# File 'lib/ukiryu/models/executable_info.rb', line 68 def alias? source == :alias end |
#description ⇒ String
Human-readable description
56 57 58 59 60 61 62 63 |
# File 'lib/ukiryu/models/executable_info.rb', line 56 def description case source when :path "Found in PATH at #{path}" when :alias "Shell alias in #{shell}: #{alias_definition}" end end |
#path? ⇒ Boolean
Check if this was found in PATH
75 76 77 |
# File 'lib/ukiryu/models/executable_info.rb', line 75 def path? source == :path end |