Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Change names access helper to iterate over the ancestors instead of doing dup/shift #410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/v8/access/names.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ def delete(obj, name, &dontintercept)

def accessible_names(obj, special_methods = false)
obj.public_methods(false).map {|m| m.to_s}.to_set.tap do |methods|
ancestors = obj.class.ancestors.dup
while ancestor = ancestors.shift
obj.class.ancestors.each do |ancestor|
break if ancestor == ::Object
methods.merge(ancestor.public_instance_methods(false).map {|m| m.to_s})
end
Expand All @@ -62,4 +61,4 @@ def special?(name = nil)
name.nil? ? @special : @special[name]
end
end
end
end