...

/

Method Definition

Method Definition

Define our method in Ruby.

Stand-alone methods

So far, we’ve seen methods that are defined on objects and can be called on objects. That is, we’ve seen the downcase method that’s defined on every string.

However, Ruby also allows for methods that aren’t defined on any of these objects. They’re sort of stand-alone methods.

For example, we can try this out:

Press + to interact
Ruby
puts is_a?(Object)

We’ll focus on this type of method in this chapter because we want to focus on the characteristics of methods. Take a look at the bonus chapter about the ...