Class: PosixProxy::CmdStub

Inherits:
Object
  • Object
show all
Defined in:
lib/shell-proxy/posix.rb

Instance Method Summary collapse

Constructor Details

#initialize(buffer) ⇒ CmdStub

Returns a new instance of CmdStub.



121
122
123
# File 'lib/shell-proxy/posix.rb', line 121

def initialize(buffer)
  @buffer = buffer
end

Instance Method Details

#emit(data) ⇒ Object



125
126
127
# File 'lib/shell-proxy/posix.rb', line 125

def emit(data)
  @emitter.call(data)
end

#|(other) ⇒ Object



129
130
131
132
133
134
# File 'lib/shell-proxy/posix.rb', line 129

def |(other)
  # Append a pipe to the second last command in the stack
  last = @buffer.pop
  @buffer << "#{@buffer.pop} | #{last.strip}"
  self
end