I'm trying to understand how the puts function fits in Ruby's "Everything is an object" stance.
Is puts is the method of a somehow hidden class/object? Or is it a free-floating method, with no underlying object?
|
I'm trying to understand how the Is |
|||
|
|
First off, Ruby doesn't have functions. It only has methods. Thus,
No, it's just a boring old instance method of a boring old class. (Well, a boring old instance method of a boring old mixin, actually, but a mixin is just a class which abstracts over its superclass.)
There is no such thing. A method is always associated with an object (the receiver of the message), that's what makes it a "method". (At least in OO parlance. In ADT-oriented languages, the word "method" means something slightly different.) By the way, the easiest option is always to just ask Ruby herself:
|
|||||||||
|