From: Torsten Mangner Date: 2008-07-04T15:00:27+09:00 Subject: Re: Basic ruby Question Raveendran Jazzez wrote: > But it was working in this way. > > class Universe > def self.private_method > p "=========Hello world=======" > end > end > u=Universe.new > u.private_method > > # => private.rb:7: undefined method `private_method' for > # (NoMethodError) Your second example, does not work either. You tried to call a class-method on an object. I don't know how useful a private class-method could be. it doesn't make to much sense for me. i'm pretty sure, all you want is a simple instance-method: leave out the "self." at the methods declaration: private def private_method p "something" end > what is the Difference betweeen these two types? > > u=Universe.new > u.private_method && Universe.private_method for the difference between instance and class-methods use google on there terms. the first explanation i found, should be sufficient: http://www.juixe.com/techknow/index.php/2007/01/22/ruby-class-tutorial/ -- Posted via http://www.ruby-forum.com/.