Class: Ukiryu::Execution::CommandInfo
- Inherits:
-
Object
- Object
- Ukiryu::Execution::CommandInfo
- Defined in:
- lib/ukiryu/execution/command_info.rb
Overview
Execution command information
Encapsulates details about the executed command
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#command_name ⇒ Object
readonly
Returns the value of attribute command_name.
-
#executable ⇒ Object
readonly
Returns the value of attribute executable.
-
#full_command ⇒ Object
readonly
Returns the value of attribute full_command.
-
#shell ⇒ Object
readonly
Returns the value of attribute shell.
-
#tool_name ⇒ Object
readonly
Returns the value of attribute tool_name.
Instance Method Summary collapse
-
#argument_count ⇒ Integer
Get argument count.
-
#executable_name ⇒ String
Get the executable name only.
-
#initialize(executable:, arguments:, full_command:, shell: nil, tool_name: nil, command_name: nil) ⇒ CommandInfo
constructor
A new instance of CommandInfo.
-
#inspect ⇒ String
Inspect.
-
#to_h ⇒ Hash
Convert to hash.
-
#to_s ⇒ String
String representation.
Constructor Details
#initialize(executable:, arguments:, full_command:, shell: nil, tool_name: nil, command_name: nil) ⇒ CommandInfo
Returns a new instance of CommandInfo.
11 12 13 14 15 16 17 18 |
# File 'lib/ukiryu/execution/command_info.rb', line 11 def initialize(executable:, arguments:, full_command:, shell: nil, tool_name: nil, command_name: nil) @executable = executable @arguments = arguments @full_command = full_command @shell = shell @tool_name = tool_name @command_name = command_name end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
9 10 11 |
# File 'lib/ukiryu/execution/command_info.rb', line 9 def arguments @arguments end |
#command_name ⇒ Object (readonly)
Returns the value of attribute command_name.
9 10 11 |
# File 'lib/ukiryu/execution/command_info.rb', line 9 def command_name @command_name end |
#executable ⇒ Object (readonly)
Returns the value of attribute executable.
9 10 11 |
# File 'lib/ukiryu/execution/command_info.rb', line 9 def executable @executable end |
#full_command ⇒ Object (readonly)
Returns the value of attribute full_command.
9 10 11 |
# File 'lib/ukiryu/execution/command_info.rb', line 9 def full_command @full_command end |
#shell ⇒ Object (readonly)
Returns the value of attribute shell.
9 10 11 |
# File 'lib/ukiryu/execution/command_info.rb', line 9 def shell @shell end |
#tool_name ⇒ Object (readonly)
Returns the value of attribute tool_name.
9 10 11 |
# File 'lib/ukiryu/execution/command_info.rb', line 9 def tool_name @tool_name end |
Instance Method Details
#argument_count ⇒ Integer
Get argument count
30 31 32 |
# File 'lib/ukiryu/execution/command_info.rb', line 30 def argument_count @arguments.count end |
#executable_name ⇒ String
Get the executable name only
23 24 25 |
# File 'lib/ukiryu/execution/command_info.rb', line 23 def executable_name File.basename(@executable) end |
#inspect ⇒ String
Inspect
44 45 46 |
# File 'lib/ukiryu/execution/command_info.rb', line 44 def inspect "#<Ukiryu::Execution::CommandInfo exe=#{executable_name.inspect} args=#{argument_count}>" end |
#to_h ⇒ Hash
Convert to hash
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ukiryu/execution/command_info.rb', line 51 def to_h { executable: @executable, executable_name: executable_name, tool_name: @tool_name, command_name: @command_name, arguments: @arguments, full_command: @full_command, shell: @shell } end |
#to_s ⇒ String
String representation
37 38 39 |
# File 'lib/ukiryu/execution/command_info.rb', line 37 def to_s @full_command end |