On Sun, Apr 03, 2005 at 08:39:42PM +0900, Ilias Lazaridis wrote:
[snipp]
> But to understand this fully, can someone please decrypt this:
> 
>   def meta()
>     @meta ||= {}
>   end
> 

That's lazy initialization of the @meta variable. Another (and more
verbose) way to write it would be:

def meta()
    unless @meta #If not defined, set the value
        @meta = {}
    end
    @meta # Return Meta
end

"@meta ||= {}" evaluates to "@meta = @meta || {}" and since the returned
value from a method is the last evaluated expression "@meta ||= {}"
works.

//Anders

-- 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. Anders Engströí         aengstrom / gnejs.net
. http://www.gnejs.net    PGP-Key: ED010E7F
. [Your mind is like an umbrella. It doesn't work unless you open it.]