It came handy the other day when I needed to add a spec for something that runs in a loop, to end the loop conditionally.
It's helpful to mix raising exceptions with yielding, too.
class Sut
def main_loop
until requested_stop?
abc.foo { |bar| puts bar }
end
end
end
class Abc
# ...
def foo(&_block)
bar = baz.baz
yield bar
end
end
There's no other way certain things can be done.
It came handy the other day when I needed to add a spec for something that runs in a loop, to end the loop conditionally. It's helpful to mix raising exceptions with yielding, too.