mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/irb] Update ls.rb without requiring Set, because Set is one of standard libraries
https://github.com/ruby/irb/commit/7092ad2ab5
This commit is contained in:
parent
518d39388a
commit
8ee24840c8
1 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "reline"
|
require "reline"
|
||||||
require 'set'
|
|
||||||
require_relative "nop"
|
require_relative "nop"
|
||||||
require_relative "../color"
|
require_relative "../color"
|
||||||
|
|
||||||
|
@ -33,9 +32,11 @@ module IRB
|
||||||
end
|
end
|
||||||
|
|
||||||
def class_method_map(classes)
|
def class_method_map(classes)
|
||||||
dumped = Set.new
|
dumped = Array.new
|
||||||
classes.reject { |mod| mod >= Object }.map do |mod|
|
classes.reject { |mod| mod >= Object }.map do |mod|
|
||||||
methods = mod.public_instance_methods(false).select { |m| dumped.add?(m) }
|
methods = mod.public_instance_methods(false).select do |m|
|
||||||
|
dumped.push(m) unless dumped.include?(m)
|
||||||
|
end
|
||||||
[mod, methods]
|
[mod, methods]
|
||||||
end.reverse
|
end.reverse
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue