Project

General

Profile

This project is closed and read-only.

Actions

Bug #2993

closed

Module#instance_methods' flag seems to be ignored in singleton classes

Bug #2993: Module#instance_methods' flag seems to be ignored in singleton classes

Added by fxn (Xavier Noria) over 16 years ago. Updated over 15 years ago.


Description

=begin
Looks like the flag that tells Module#instance_methods whether to include the ones of superclasses is ignored on singleton classes. For example, in 1.9:

 class A
   def self.m
   end
 end
 p (class << A; self; end).instance_methods(false)
 # => [:m, :allocate, :new, :superclass]

 class B < A
 end
 p (class << B; self; end).instance_methods(false)
 # => [:m, :allocate, :new, :superclass]

 class C < B
 end
 p (class << C; self; end).instance_methods(false)
 # => [:m, :allocate, :new, :superclass]

I tested this against 1.9.2-head, 1.9.1, and 1.8.7, the string in the "ruby -v" form field below corresponds to the first one.
=end

Actions

Also available in: PDF Atom