Sha256: 73ad9676f80dd82a441b2c53206fee35b956193677d164f330a06fce996bb8d1

Contents?: true

Size: 669 Bytes

Versions: 5

Compression:

Stored size: 669 Bytes

Contents

=begin rdoc
 Supplement [monkey patch] Kernel#methods so that it returns lists that are split into two kind of [adds a marker where the inherited methods begin].
=end
module Kernel
  alias :methods_old :methods
  def methods all = true
    if all
      # give some marker designating when the inherited methods start
      (public_methods(false) << :"inherited methods after this point >>") + (public_methods(true) - public_methods(false))
    else
      public_methods(false)
    end
  end
end

if $0 == __FILE__
  class A; end
  puts 'A.methods', A.methods(true).inspect, A.methods(false).inspect
  puts 'A.new.methods', A.new.methods.inspect
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
rogerdpack-desc_method-0.1.2 lib/method_describer/kernel_new_methods_list.rb
rogerdpack-desc_method-0.1.3 lib/method_describer/kernel_new_methods_list.rb
rogerdpack-desc_method-0.1.4 lib/method_describer/kernel_new_methods_list.rb
rogerdpack-desc_method-0.1.5 lib/method_describer/kernel_new_methods_list.rb
desc_method-0.1.5 lib/method_describer/kernel_new_methods_list.rb