From: "Benjamin J. Tilly" Date: 2001-05-02T05:25:45+09:00 Subject: [ruby-talk:14514] Re: How to do it the Ruby-way 1 >===== Original Message From Stefan Matthias Aust ===== >On Tue, 1 May 2001 03:55:51 +0900, Dave Thomas > wrote: > >>A useful idiom is >> >> @@cache[name] ||= File.open(name).read > >Thanks Dave, that's clever... FYI, in Perl the nickname for that is the Orcish Maneuver for "or-cache". There are some Perl books which are very useful for Ruby simply because so much translates pretty much directly. In particular "Effective Perl Programming" has a lot of useful idioms like the above. Cheers, Ben