ruby - Why does `BasicObject` answer methods `superclass` and `class`? -
if object < basicobject
, , #superclass
, #class
defined in object
, how possible class < basicobject
answers a.superclass
, a.class
? a.ancestors
: [a, basicobject]
going further (according new answers):
if a
instance of object
why doesn't have in ancestors?
class b;end b.ancestors # => [b, object, kernel, basicobject]
superclass
might defined in kernel
, a
doesn't have kernel
in ancestors.
kernel
included in object
(from object.rb
):
class object < basicobject include kernel end
p.s git issue confused me enough ask it
class < basicobject end
here, class a
instance of class class
.
a.class #=> class
a
answers .class
, .superclass
because class
supports them.
what thinking instance of a
, in case:
a.new (object doesn't support #inspect) =>
Comments
Post a Comment