class Deferrable::Stack
Attributes
context[R]
stack[R]
Public Class Methods
new(context:)
click to toggle source
# File lib/deferrable/stack.rb, line 3 def initialize(context:) @context = context @stack = [] end
Public Instance Methods
add(&block)
click to toggle source
# File lib/deferrable/stack.rb, line 8 def add(&block) stack.push( -> { context.instance_eval(&block) } ) end
execute()
click to toggle source
# File lib/deferrable/stack.rb, line 14 def execute stack.pop.call until stack.empty? end