From: Robert Klemme Date: 2010-11-11T17:35:15+09:00 Subject: Re: what's an object? On Thu, Nov 11, 2010 at 5:25 AM, Y. NOBUOKA wrote: >> Simple answer:  everything.  Everything is considered an object, >> including an instance of a class, the class itself, its methods, etc. > > There is one thing incorrect. > In Ruby, an instance of a class or a class itself is exactly an object, > while a method is NOT an object. > > Although we can obtain a Method object using the *Object#method* > method [ http://ruby-doc.org/core/classes/Object.html#M000336 ], a > method itself is not an object. I suggest a modification of Alex's definition: Everything /which can be referenced through a variable/ is considered an object. This includes classes, instances of Method etc. It's just that Method and subclasses are basically only proxies to the underlying implementation of a method - with limited functionality (obtaining arity and executing them for example). The mere fact that we obtain a new instance whenever we invoke #method hints at this: irb(main):005:0> s=""; 2.times.map { s.method(:length).object_id } => [134981756, 134981742] Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/