RFS: Classes and Objects - 008

Classes and Objects are the basis of most of the work we'll be doing in Ruby. Let's create our own custom class in this episode.

Defining a Class

class Productend

This is the simplest class we can create in ruby, it does nothing for now.

Creating an Instance

Let's create an instance of this class.

product = Product.new=> #<Product:0x00007ff666a81128>

We now have an instance of the Product class. We can create more instances of this class. But it get's pretty boring since it does nothing. Let's explore what else we can do in the next episode.