H
Howard Lewis Ship
I've had a couple of places where I really needed to just return from
a block. From what I can see, if my block is inside a method, the
return will return from the method, not return control *to* the
method. I've ended up writing some very Pascal like code:
Find.find(*ARGV) do |f|
if f =~ /[CVS|SVN]/
Find.prune
else
$matches += 1 if match?(f)
end
end
Where what I'd prefer to write would be:
Find.find(*ARGV) do |f|
if f =~ /[CVS|SVN]/
Find.prune
return-from-block-to-method
end
$matches += 1 if match?(f)
end
Is there a way to return control from the block to the method?
--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com
a block. From what I can see, if my block is inside a method, the
return will return from the method, not return control *to* the
method. I've ended up writing some very Pascal like code:
Find.find(*ARGV) do |f|
if f =~ /[CVS|SVN]/
Find.prune
else
$matches += 1 if match?(f)
end
end
Where what I'd prefer to write would be:
Find.find(*ARGV) do |f|
if f =~ /[CVS|SVN]/
Find.prune
return-from-block-to-method
end
$matches += 1 if match?(f)
end
Is there a way to return control from the block to the method?
--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com