Projects

Ticket #563 (new defect)

Opened 2 years ago

Last modified 14 months ago

Retrieving the singleton class of a class seems to return Class.

Reported by: eloy.de.enige@… Owned by: lsansonetti@…
Priority: blocker Milestone: MacRuby 1.0
Component: MacRuby Keywords: mocha
Cc:

Description

For example:

% cat t.rb
class A
  def self.singleton_class
    (class << self; self; end)
  end
end

p A.singleton_class

% ruby19 t.rb
#<Class:A>

% macruby t.rb
Class

Change History

Changed 2 years ago by pthomson@…

I think the problem here is just in the #inspect method for singleton classes. The object_id's of A's singleton class and A's class are different:

irb(main):008:0> A.singleton_class.object_id
=> 8592372416
irb(main):009:0> A.class.object_id
=> 8590007040
irb(main):010:0> A.class == Class
=> true
irb(main):011:0> A.singleton_class == Class
=> false

Changed 14 months ago by lsansonetti@…

  • milestone set to MacRuby 1.0
Note: See TracTickets for help on using tickets.