Object-oriented programming is a paradigm that has become the foundation of many modern programming languages, and it's at the core of Ruby. In short, the object-oriented programming sees the world as data, modeled in code by "objects". When working with data, this model of programming is most apt, as it allows us to model our program as we would see the real world.
The object-oriented programming paradigm, or OOPs as it's popularly called, is based upon a few principles, let's look at them one at a time:
Encapsulation: This is a concept that ensures a certain functionality is hidden from the rest of the code. Its primary use is to ensure that the underlying data is protected, and can only be manipulated in a way the object desires. Ruby accomplishes this by creating objects. The objects expose certain interfaces (also known as methods), using which the interaction can happen with those objects.
Polymorphism: This is the ability to represent the same thing in multiple forms...