P
Peter Szinek
Hey guys,
Can Ruby do this in some way:
def foo(bar)
#DO SOMETHING with bar here resulting in baz being set to {}
end
baz = {:fluff =>
rk}
foo(baz)
#baz should be {} now
I'd like to use it in a code which calls a callback, (the foo method in
this case) but the callback is called from multiple places, and only
inside foo() we know whether we want to empty the array or not... it
would be complicated to return something from foo() with the current
architecture (based on which we could empty the hash or not).
My Ruby version is JRuby 1.6 if that makes any difference.
Cheers,
Peter
Can Ruby do this in some way:
def foo(bar)
#DO SOMETHING with bar here resulting in baz being set to {}
end
baz = {:fluff =>
foo(baz)
#baz should be {} now
I'd like to use it in a code which calls a callback, (the foo method in
this case) but the callback is called from multiple places, and only
inside foo() we know whether we want to empty the array or not... it
would be complicated to return something from foo() with the current
architecture (based on which we could empty the hash or not).
My Ruby version is JRuby 1.6 if that makes any difference.
Cheers,
Peter