DEV Community

Luke O'Connell
Luke O'Connell

Posted on

Today I learned. Defining our own classes-review

We declare attributes to classes using the attr_accessor keyword. When we refer to a class in Ruby we use capital letters. Multi-word names use CamelCase. We can define our own methods using the def keyword. We use the self keyword when we don't know in advance what the variable name is. Instance methods are called on an instance of a class and are used to modify the attributes of an object. Class methods are called on the class itself and are used for tasks that involve the class as a whole.

Top comments (1)

Collapse
 
heratyian profile image
Ian

😎