Skip to content

When call Kernel#singleton_class. And instance variables disappeared from Kernel#inspect. #266

@kachick

Description

@kachick

Are below behaviors expected in JRuby?

$VERBOSE = true

class Foo

  def initialize(bool)
    @pre = 1

    if bool
      singleton_class
    end

    @post = 2
  end

end

p Foo.new(true)
p Foo.new(false)

CRuby

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

#<Foo:0x858b8b4 @pre=1, @post=2>
#<Foo:0x858b814 @pre=1, @post=2>

JRuby

jruby 1.7.0.preview2 (1.9.3p203) 2012-08-21 82eb396 on OpenJDK Server VM 1.6.0_24-b24 [linux-i386]

#<Foo:0xb655a>
#<Foo:0x2b1682 @pre=1, @post=2>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions