Chapter 2. Objects, methods, and local variables


In this chapter

  • Objects and object-orientation
  • Innate vs. learned object capabilities
  • Method parameter, argument, and calling syntax
  • Local variable assignment and usage
  • Object references


In this chapter, we’ll begin exploring the details of the Ruby programming language. We’ll look first and foremost at the concept of the object, around which almost every line of Ruby code you’ll write will revolve. What you do with objects, broadly speaking, is send them messages, most of which correspond to names of methods that you’re asking the object to execute. We’ll look in considerable detail at the combined processes of message sending and method calling.

Ruby objects are often (perhaps most often) ...

Get The Well-Grounded Rubyist now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.