class Rundoc::CodeCommand::Pipe
Public Class Methods
Source
Public Instance Methods
Source
# 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
before: “”, after: “”, commands:
[[cmd, output], [cmd, output]]
Private Instance Methods
Source
# File lib/rundoc/code_command/pipe.rb, line 27 def parse(code) parser = Rundoc::PegParser.new.method_call tree = parser.parse(code) actual = Rundoc::PegTransformer.new.apply(tree) actual = actual.first if actual.is_a?(Array) actual = Rundoc::CodeCommand::Bash.new(code) if actual.is_a?(Rundoc::CodeCommand::NoSuchCommand) actual # Since `| tail -n 2` does not start with a `$` assume any "naked" commands # are bash rescue Parslet::ParseFailed Rundoc::CodeCommand::Bash.new(code) end