Skip to content
This repository was archived by the owner on Dec 29, 2018. It is now read-only.

Commit a5f6287

Browse files
committed
Clean up lib/sicuro/runtime/whitelist.rb.
1 parent ac0d99f commit a5f6287

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

lib/sicuro/runtime/whitelist.rb

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,9 @@ def self.enforce_whitelist!
2323
(const.methods + const.private_methods - $TRUSTED_METHODS_ALL - trusted).each do |method_name|
2424
m = method_name.to_sym.inspect
2525

26-
# FIXME: Make this less horrifyingly gross.
27-
begin
28-
eval("public #{m}; undef #{m}")
29-
rescue NameError => e
30-
# Re-raise the error as long as it is not telling us
31-
# the method we are trying to remove is undefined.
32-
unless e.message.start_with?("undefined method `#{method_name.to_s}' ")
33-
raise
34-
end
35-
end
36-
37-
38-
#next unless method_defined?('define_method')
39-
#define_method(meth) {}
40-
41-
#remove_method(meth) rescue nil
42-
#eval("public #{m}; undef #{m}")
43-
#puts "Removing #{constant}.#{meth}"
44-
#undef_method meth if respond_to?(meth)
26+
next unless method_defined?(method_name) || public_method_defined?(method_name) || private_method_defined?(method_name)
27+
28+
undef_method method_name
4529
end
4630
end
4731
end

0 commit comments

Comments
 (0)