What are Attributes in Ruby?

Attributes in Ruby:

In Ruby, an object that is totally secretive is pretty useless. You can create it, but then you can’t do anything with it. You’ll normally define methods that let you access and manipulate the state of an object, allowing the outside world to interact with the object. These externally visible facets of an object are called its attributes.

Types of Attributes in Ruby:

There are mainly two types of Attributes in Ruby:
i. Writable Attributes: These attributes allow one to set an attribute from outside the object.
ii. Virtual Attributes: These attribute-accessing methods do not have to be just simple wrappers around an object’s instance variables.