On Tue, 2006-03-21 at 19:20 +0900, Bhrgunatha Deva wrote:
> Newbie question:
> 
> Is there an equivalent to a static constructor in ruby?
> something like:
> 
> class MyClass
>    # want this to run before any instances of MyClass are created
>    def class_initialize
>      self.some_complex_initialisation
>    end
> end

Do you mean something like:

class InitMe
  def self.complex_init
    puts "Initializing #{self}"
  end

  complex_init
end
#(p) Initializing InitMe
# => nil

or even just:

class InitMe
  puts "Initializing #{self}"
end
#(p) Initializing InitMe
# => nil

?

-- 
Ross Bamford - rosco / roscopeco.REMOVE.co.uk