RE: [Rails] Difference in public class methods and instance methods?

"Public" refers to the accessibility of the methods--public methods can be called from anyplace. Compare private methods, which are only accessible from within the module where they are defined (or something close to that).

Instance methods are called on (and operate on) particular well, instances of a class. In this code:

  x = "boogers"
  x.length # -> 7

The .length method on the String class is an instance method. We are asking *this particular instance* of String (which we have given the name 'x') how many characters it has.

Class methods are called on the class itself. For example, is a class method--the class creates a new string and returns it. You couldn't say is just an instance of string. The only thing that can create new instances of String is the String class. In other languages these are often called 'static' methods.

For more detail, I recommend David Black's _Ruby For Rails_, and/or the pickaxe book.