From: "David A. Black" Date: 2008-09-11T20:45:10+09:00 Subject: Re: define and call methods in ruby Hi -- On Thu, 11 Sep 2008, Jay Pangmi wrote: > Hi, I just simply can't figure out how I can define methods and call it > in a class. I've tried(as I read so) the following: > > class Myclass > .... > method_to_call > .... > def method_to_call > ..... > end > end > > but just doesn't work. So, please point me out on where I'm doing wrong. > thanks.. This will get you started: class Myclass def method_to_call puts "Hello!" end end object = Myclass.new object.method_to_call It's the object (the instance of Myclass) that can execute the method. David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancing with Rails January 19-22 Fort Lauderdale, FL * * Co-taught with Patrick Ewing! See http://www.rubypal.com for details and updates!