Hacker News new | ask | show | jobs
by jablan 1951 days ago
Sorry, Ruby methods are not objects. They can surely be wrapped in objects of class Method, but this feature is used quite rarely. Whether this is due to the syntax, the confusion regarding the evaluation scope, or something else, I have no idea.
2 comments

The only way of obtaining a method in Ruby returns it as an object. Whether or not they "are" an object is thus entirely an implementation detail.

I think part of the confuction here is that "ob.puts" for example, does not directly access a method. It denotes passing a message to "ob". That message may or may not be routed to a "puts" method.

But at no point does Ruby allow you to get hold of any kind of reference to a method that is anything but an object.

Yeah, you got it, see my reply to capableweb. Thanks!