Sublime
An inspiration engine for ideas
Ruby is an object-oriented language,
Joe Leo • The Well-Grounded Rubyist

Ruby’s shortcut operators
Joe Leo • The Well-Grounded Rubyist
Polished Ruby Programming: Build better software with more intuitive, maintainable, scalable, and high-performance Ruby code
amazon.com
Ruby objects are often (perhaps most often) handled via variables that represent them,
Joe Leo • The Well-Grounded Rubyist
And there’s an attr_writer method, too: class Ticket attr_writer :price end With that single line, we wrote (or, rather, Ruby wrote for us) our price= setter method. One line takes the place of three. In the case of the reader methods, one line took the place of nine!
Joe Leo • The Well-Grounded Rubyist
Notice that ruby_version isn’t defined in the class of which the object is an instance. Instead, it’s defined in a module that the class mixes in.
Joe Leo • The Well-Grounded Rubyist
You’ll write complex getter and setter methods sometimes, but the simple get and set operations, wrapped around instance variables, are the most common—so common, in fact, that Ruby gives you some shortcuts for writing them.
Joe Leo • The Well-Grounded Rubyist
Ruby sees all data structures and values—from simple scalar (atomic) values like integers and strings, to complex data structures like arrays—as objects. Every object is capable of understanding a certain set of messages. Each message that an object understands corresponds directly to a method—a named, executable routine whose execution the object
... See more