Other Pages

Expand All

Helpful Examples

The right example or diagram can go a long way toward helping a beginner grasp an abstract concept. Add examples, metaphors, similies, diagram, or approach to teaching concepts or terms here.

Classes and Methods

Verbing a noun.

> "word".upcase
 => "WORD" 

This follows the format "object.method". Method is a verb, and object is our direct object (the thing the method is acting on). So in this case, we are saying "please take 'word' and make it uppercase"

You can also use classes to retrieve characteristics of an object.

> 1.class
 => Fixnum 

So in this case, we are saying "hey 1, what is your class?" To which it replies, "I'm a FixNum, of course!"


This image was really, really helpful to me as I was learning it: