From: Stefano Crocco Date: 2012-01-22T05:03:34+09:00 Subject: Re: What's wrong with this? Il giorno Sun, 22 Jan 2012 04:56:33 +0900 Paet Worlds II ha scritto: > Hey everyone, I'm very new to Ruby and I'm starting to do a bit more > hands-on practice... So I decided to make an attempt at making a small > bit of code, but when I run it, nothing happens... Can someone please > explain why?... > > Here is what I have so far: > > > > class RoboEngine > > def initialize > puts "Initializing..." > Init.action1 > end > > end > > class Initialization > > def action1 > puts "Initialized!" > sleep(0.3) > puts "Loading Thought Process..." > end > end > > Init = Initialization.new > > > > > So why is it that when I run this, nothing happens? Nothing is > printed... > You create an object of class Initialization and assign it to the constant Init. The only methods which are called is Initialization#initialize, called from Initialize.new. Since you haven't defined it, Object#initialize is used instead and it does nothing. I guess what you want is to also create an instance of RoboEngine, after creating the Initialization object: Init = Initialization.new robo = RoboEngine.new I hope this helps Stefano