Permalink
Browse files

Be more conservative with undef_object in Solution and Vocabulary. Th…

…is addresses issue #108
  • Loading branch information...
1 parent 6030304 commit ab8b3453b85315fe60a6a2a9e21c69486f73d716 @gkellogg gkellogg committed Mar 20, 2013
Showing with 10 additions and 4 deletions.
  1. +5 −3 lib/rdf/query/solution.rb
  2. +5 −1 lib/rdf/vocab.rb
@@ -22,9 +22,11 @@ class RDF::Query
#
class Solution
# Undefine all superfluous instance methods:
- undef_method(*(instance_methods.map(&:to_sym) - [:__id__, :__send__, :__class__, :__eval__,
- :object_id, :dup, :instance_eval, :inspect, :to_s,
- :class, :is_a?, :respond_to?, :respond_to_missing?]))
+ undef_method(*instance_methods.
+ map(&:to_s).
+ select {|m| m =~ /^\w+$/}.
+ reject {|m| %w(object_id dup instance_eval inspect to_s class).include?(m) || m[0,2] == '__'}.
+ map(&:to_sym))
include Enumerable
View
@@ -129,7 +129,11 @@ def self.__prefix__
end
# Undefine all superfluous instance methods:
- undef_method(*(instance_methods.map(&:to_sym) - [:__id__, :__send__, :__class__, :__eval__, :object_id, :instance_eval, :inspect, :class, :is_a?]))
+ undef_method(*instance_methods.
+ map(&:to_s).
+ select {|m| m =~ /^\w+$/}.
+ reject {|m| %w(object_id dup instance_eval inspect to_s class).include?(m) || m[0,2] == '__'}.
+ map(&:to_sym))
##
# @param [RDF::URI, String, #to_s] uri

0 comments on commit ab8b345

Please sign in to comment.