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.
782 783 784 785 |
# File 'lib/eggshell/bundles/basics.rb', line 782 def initialize(eggshell, cond) @eggshell = eggshell @cond = cond end |
Instance Method Details
#each(&block) ⇒ Object
787 788 789 790 791 792 793 794 795 796 797 |
# File 'lib/eggshell/bundles/basics.rb', line 787 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 |