Class: Rundoc::CodeCommand::Pipe

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

Constant Summary

Constants inherited from Rundoc::CodeCommand

NEWLINE

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”



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

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

Instance Method Details

#call(env = {}) ⇒ Object

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

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


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

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



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

def to_md(env = {})
  ""
end