module GoTo

Constants

STACK

Public Instance Methods

frame_end_goto() click to toggle source
# File lib/rubyhacks.rb, line 956
def frame_end_goto
        frame = STACK.pop
        idx = 0

        begin
                for i in (idx...frame.size)
                        frame[i].block.call if frame[i].block
                end
        rescue Goto => g
                idx = frame.index(g.label)
                retry
        end
end
frame_start_goto() click to toggle source
# File lib/rubyhacks.rb, line 952
def frame_start_goto
        STACK << []
end
goto(label) click to toggle source
# File lib/rubyhacks.rb, line 970
def goto(label)
        raise Goto.new(label)
end
label_goto(sym, &block) click to toggle source
# File lib/rubyhacks.rb, line 948
def label_goto(sym, &block)
        STACK.last << Label.new(sym, block)
end