Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
Class (not instance) initializers
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Bhrgunatha Deva, post: 4509759"] 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 At the moment I'm using: class MyClass def initialize @@init = self.some_complex_initialisation if @@init.nil? end end I'd love to know if there is a more rubyesque way of doing this Bhrgunatha. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Class (not instance) initializers
Top