Listing Methods
This lesson teaches how to list down an object's methods and how to "chain" method calls with a single line of code!
As said above, if you are curious what methods are defined on a certain object, then you can check the Ruby documentation for this class. (Usually the right page conveniently shows up at the top when you google for “ruby” and the class name.)
However, you can also quickly pop into IRB and ask the object for its methods.
That’s right, methods
is a method defined on all objects (just like class
,
and is_a?
).
When you call it then it will return (respond with) an Array with all the method ...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy