Abinoam Jr. wrote in post #1136161:

>
>> My question is, how can i call a class method on a class X with
>> X.classMethod if the method is defined on a singleton class as an
>> instance method of that class(i am not asking how can i do it. It is
>> what happens.).
>
> The method lookup chain searches first for methods defined on its
> metaclass.
>
>>  It confuses me even more, because i noticed(running some tests) that
>> the singleton class of a class is not even hierarchically related to the
>> class it comes from,
>
> We could say that a class is an instance of its metaclass.

Technically No. :)

class Foo
  def bar
    12
  end
end

singleton_klass = Foo.singleton_class
Foo.instance_of? singleton_klass # => false

*The method lookup chain searches first for methods defined on its
metaclass.* ? Although it is correct .

class Foo
  def bar
    12
  end
end

foo = Foo.new

def foo.bar
  11
end

foo.bar # => 11

Then how is *Or... the metaclass is "inserted" between MyClass and its 
class (Class) in the method lookup chain.* true ?

-- 
Posted via http://www.ruby-forum.com/.