I am having problems returning a value from a proc object:
@@mappings.each{ |hsh|
begin
if( hsh['type'] == c['type'] ) then
eval( "comp=#{hsh['template']}" )
hsh.each_key{ |key|
m = proc { @@ignore.each{ |i| return true if( key == i ) }
}.call
puts m;
}
has_mapping = true;
end
rescue; raise "Unable to evaluate passed in expression:
#{hsh['template']}"; end
break if( has_mapping ); }
It is at the line: m = proc { @@ignore.each{ |i| return true if( key
== i ) } }.call
that I am having the problem. I want "m" to be true, but instead it
leaves the calling function.
I have modified the line to be:
m = nil;
proc { @@ignore.each{ |i| m=true if( key == i ) } }.call
but I was just wondering if I could return a value w/o having to leave
the outer function.
Zach