Skip to content

Class does not inherit singleton_class's class methods #287

Description

@kachick

I have faced a different behavior with MRI/YARV.
Is this expected?

set up

class Foo
  class << self
    class << self
      def foo; end
    end
  end
end

class Bar < Foo; end

Bar.singleton_class.foo

MRI/YARV

ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

Bar.singleton_class.foo #=> nil

JRuby

jruby 1.7.0.preview2 (1.9.3p203) 2012-09-03 b37a0bd on Java HotSpot(TM) Server VM 1.7.0_07-b10 [linux-i386]

Bar.singleton_class.foo #=> NoMethodError: undefined method `foo' for #<Class:Bar>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions