Class: Yap::Shell::Execution::CommandExecution
- Inherits:
-
Object
- Object
- Yap::Shell::Execution::CommandExecution
- Defined in:
- lib/yap/shell/execution/command_execution.rb
Direct Known Subclasses
BuiltinCommandExecution, FileSystemCommandExecution, RubyCommandExecution, ShellCommandExecution
Instance Attribute Summary collapse
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdin ⇒ Object
readonly
Returns the value of attribute stdin.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
-
#world ⇒ Object
readonly
Returns the value of attribute world.
Class Method Summary collapse
Instance Method Summary collapse
- #execute(command:, n:, of:, wait: true) ⇒ Object
-
#initialize(stdin:, stdout:, stderr:, world:) ⇒ CommandExecution
constructor
A new instance of CommandExecution.
- #suspended? ⇒ Boolean
Constructor Details
#initialize(stdin:, stdout:, stderr:, world:) ⇒ CommandExecution
Returns a new instance of CommandExecution.
13 14 15 16 |
# File 'lib/yap/shell/execution/command_execution.rb', line 13 def initialize(stdin:, stdout:, stderr:, world:) @stdin, @stdout, @stderr = stdin, stdout, stderr @world = world end |
Instance Attribute Details
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
3 4 5 |
# File 'lib/yap/shell/execution/command_execution.rb', line 3 def stderr @stderr end |
#stdin ⇒ Object (readonly)
Returns the value of attribute stdin.
3 4 5 |
# File 'lib/yap/shell/execution/command_execution.rb', line 3 def stdin @stdin end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
3 4 5 |
# File 'lib/yap/shell/execution/command_execution.rb', line 3 def stdout @stdout end |
#world ⇒ Object (readonly)
Returns the value of attribute world.
3 4 5 |
# File 'lib/yap/shell/execution/command_execution.rb', line 3 def world @world end |
Class Method Details
.on_execute(&blk) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/yap/shell/execution/command_execution.rb', line 5 def self.on_execute(&blk) if block_given? @on_execute_blk = blk else @on_execute_blk end end |
Instance Method Details
#execute(command:, n:, of:, wait: true) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/yap/shell/execution/command_execution.rb', line 18 def execute(command:, n:, of:, wait:true) if self.class.on_execute self.instance_exec(command:command, n:n, of:of, wait:wait, &self.class.on_execute) else raise NotImplementedError, "on_execute block hasn't been implemented!" end end |
#suspended? ⇒ Boolean
26 27 28 |
# File 'lib/yap/shell/execution/command_execution.rb', line 26 def suspended? @suspended end |