Class: IfHandler
- Inherits:
-
Object
- Object
- IfHandler
- Defined in:
- lib/shell-proxy/posix/if.rb
Instance Method Summary collapse
- #else(&block) ⇒ Object
- #elseif(condition, &block) ⇒ Object
-
#initialize(buffer) ⇒ IfHandler
constructor
A new instance of IfHandler.
- #then(&block) ⇒ Object
Constructor Details
#initialize(buffer) ⇒ IfHandler
Returns a new instance of IfHandler.
16 17 18 |
# File 'lib/shell-proxy/posix/if.rb', line 16 def initialize(buffer) @buffer = buffer end |
Instance Method Details
#else(&block) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/shell-proxy/posix/if.rb', line 34 def else(&block) @buffer << "else" @buffer.indent block.call @buffer.undent end |
#elseif(condition, &block) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/shell-proxy/posix/if.rb', line 27 def elseif(condition, &block) @buffer << "else if #{condition}" @buffer.indent block.call @buffer.undent end |
#then(&block) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/shell-proxy/posix/if.rb', line 20 def then(&block) @buffer << "then" @buffer.indent block.call @buffer.undent end |