Class: IfStub

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

Instance Method Summary collapse

Constructor Details

#initialize(condition, &block) ⇒ IfStub

Returns a new instance of IfStub.



2
3
4
5
# File 'lib/shell-proxy/posix/if.rb', line 2

def initialize(condition, &block)
  @condition = condition
  @block = block
end

Instance Method Details

#__handle(buffer) ⇒ Object



7
8
9
10
11
12
# File 'lib/shell-proxy/posix/if.rb', line 7

def __handle(buffer)
  handler = IfHandler.new(buffer)
  buffer << "if #{@condition}"
  @block.call(handler)
  buffer << "fi"
end