Class: Eggshell::Bundles::Basic::ControlLoopMacros::WhileLoopWrapper
- Inherits:
-
Object
- Object
- Eggshell::Bundles::Basic::ControlLoopMacros::WhileLoopWrapper
- Defined in:
- lib/eggshell/bundles/basics.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(eggshell, cond) ⇒ WhileLoopWrapper
constructor
A new instance of WhileLoopWrapper.
Constructor Details
#initialize(eggshell, cond) ⇒ WhileLoopWrapper
Returns a new instance of WhileLoopWrapper.
773 774 775 776 |
# File 'lib/eggshell/bundles/basics.rb', line 773 def initialize(eggshell, cond) @eggshell = eggshell @cond = cond end |
Instance Method Details
#each(&block) ⇒ Object
778 779 780 781 782 783 784 785 786 787 788 |
# File 'lib/eggshell/bundles/basics.rb', line 778 def each(&block) counter = 0 struct = Eggshell::ExpressionEvaluator.struct(@cond) cond = @eggshell.expr_eval(struct) while cond yield(counter) counter += 1 cond = @eggshell.expr_eval(struct) end end |