Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ls.rb without requiring Set, because Set is one of standard libraries #254

Merged
merged 1 commit into from
Jun 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/irb/cmd/ls.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require "reline"
require 'set'
require_relative "nop"
require_relative "../color"

Expand Down Expand Up @@ -33,9 +32,11 @@ def dump_methods(o, klass, obj)
end

def class_method_map(classes)
dumped = Set.new
dumped = Array.new
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]
end.reverse
end
Expand Down