Class: Rundoc::CodeCommand::Pipe

Inherits:
Rundoc::CodeCommand show all
Defined in:
lib/rundoc/code_command/pipe.rb

Instance Attribute Summary

Attributes inherited from Rundoc::CodeCommand

#command, #contents, #keyword, #original_args, #render_command, #render_result

Instance Method Summary collapse

Methods inherited from Rundoc::CodeCommand

#hidden?, #not_hidden?, #push

Constructor Details

#initialize(line) ⇒ Pipe

:

ls

:

| tail -n 2

> “testntmp.filen”



8
9
10
# File 'lib/rundoc/code_command/pipe.rb', line 8

def initialize(line)
  @delegate = parse(line)
end

Instance Method Details

#call(env = {}) ⇒ Object

before: “”, after: “”, commands:

[[cmd, output], [cmd, output]]


16
17
18
19
20
21
22
# File 'lib/rundoc/code_command/pipe.rb', line 16

def call(env = {})
  last_command = env[:commands].last
  puts "Piping: results of '#{last_command[:command]}' to '#{@delegate}'"

  @delegate.push(last_command[:output])
  @delegate.call(env)
end

#to_md(env = {}) ⇒ Object



24
25
26
# File 'lib/rundoc/code_command/pipe.rb', line 24

def to_md(env = {})
  ""
end