main vs initialize in Ruby

Posted by Dave on Stack Overflow See other posts from Stack Overflow or by Dave
Published on 2011-01-01T21:44:31Z Indexed on 2011/01/01 21:53 UTC
Read the original article Hit count: 305

Filed under:
|
|

Okay, so I've looked through a couple of my ruby books and done some googling to no avail.

What is the difference between main and initialize in Ruby? I've seen code that uses

class Blahblah
def main
some logic here
end
#more methods... end

and then calls it using Blahblah.new. Isn't new reserved only for initialize? if not, then what's the difference between the two?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about initialization