Class: Rundoc::CodeCommand::PipeRunner
- Inherits:
-
Object
- Object
- Rundoc::CodeCommand::PipeRunner
- Defined in:
- lib/rundoc/code_command/pipe.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
-
#call(env = {}) ⇒ Object
before: “”, after: “”, commands: [[cmd, output], [cmd, output]].
-
#initialize(user_args:, render_command:, render_result:, io:, contents: nil) ⇒ PipeRunner
constructor
A new instance of PipeRunner.
- #to_md(env = {}) ⇒ Object
Constructor Details
#initialize(user_args:, render_command:, render_result:, io:, contents: nil) ⇒ PipeRunner
Returns a new instance of PipeRunner.
16 17 18 19 |
# File 'lib/rundoc/code_command/pipe.rb', line 16 def initialize(user_args:, render_command:, render_result:, io:, contents: nil) @io = io @delegate = parse(user_args.line) end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
14 15 16 |
# File 'lib/rundoc/code_command/pipe.rb', line 14 def io @io end |
Instance Method Details
#call(env = {}) ⇒ Object
before: “”, after: “”, commands:
[[cmd, output], [cmd, output]]
25 26 27 28 29 30 31 |
# File 'lib/rundoc/code_command/pipe.rb', line 25 def call(env = {}) last_command = env[:commands].last io.puts "Piping: results of '#{last_command[:command]}' to '#{@delegate}'" @delegate.push(last_command[:output]) @delegate.build(io: io).call(env) end |
#to_md(env = {}) ⇒ Object
33 34 35 |
# File 'lib/rundoc/code_command/pipe.rb', line 33 def to_md(env = {}) "" end |