I had the same problem as the DSL entry for the web framework in ruby ββ... (Anorexic web framework will download!) ...
In any case, I burst into the insides of ruby ββand found a simple solution using the LocalJumpError returned when the Proc calls were returned ... it has worked well in the tests so far, but I'm not sure if it is fully proven:
def thing(*args, &block) if block block_response = nil begin block_response = block.call rescue Exception => e if e.message == "unexpected return" block_response = e.exit_value else raise e end end puts "value=#{block_response}" else puts "no block given" end end
the if statement in the rescue segment might look something like this:
if e.is_a? LocalJumpError
but this is uncharted territory for me, so I will stick to what I have tested so far.
Myst Oct 11 '14 at 20:55 2014-10-11 20:55
source share