Hi --

On Wed, 12 Apr 2006, Wes Gamble wrote:

> All,
>
> Is there a notion of a class level "static" code block in Ruby that
> would get executed whenever the class is loaded?  Basically the
> equivalent of Java's "static {...}" construct?
>
> I don't necessarily want to put this in an initialize method because
> it's just loading up static data from configuration files.
>
> Or do I have to put the code into an initialize method in my class and
> then guard it so that it's only executed once?

How about:

   class MyClass
     # code here
   end

?


David

-- 
David A. Black (dblack / wobblini.net)
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)

"Ruby for Rails" coming in PDF April 15, and in paper May 5!
http://www.manning.com/black