Ruby double pipe assignment with block/proc/lambda?
You can use begin
..end
:
@foo ||= begin # any statements hereend
or perhaps consider factoring the contents of the block into a separate method.
I usually write it like this:
@foo ||= ( myobject.attr = new_val myobject.other_attr = other_new_val myobject.bar(args))
@foo ||= unless @foo myobject.attr = new_val myobject.other_attr = other_new_val myobject.bar(args)end