diff --git a/lib/rexml/functions.rb b/lib/rexml/functions.rb index a558ccdf..8f752853 100644 --- a/lib/rexml/functions.rb +++ b/lib/rexml/functions.rb @@ -12,16 +12,10 @@ class FunctionsClass # :nodoc: def initialize @context = nil - @namespace_context = {} - @variables = {} @node_indexes = nil end INTERNAL_METHODS = [ - :namespace_context, - :namespace_context=, - :variables, - :variables=, :context=, :node_indexes=, :target_named_node, @@ -37,11 +31,6 @@ def method_added(name) end end - def namespace_context=(x) ; @namespace_context=x ; end - def variables=(x) ; @variables=x ; end - def namespace_context ; @namespace_context ; end - def variables ; @variables ; end - def context=(value); @context = value; end # The evaluation's shared index cache, set by XPathParser so that sorting @@ -433,8 +422,7 @@ def send(name, *args) end end - # Using this singleton instance may cause thread-safety issues - # especially when accessing variables, context and namespace_context. + # Using this singleton instance may cause thread-safety issues. # Consider instantiating your own FunctionsClass object. Functions = FunctionsClass.new # :nodoc: end diff --git a/lib/rexml/parsers/xpathparser.rb b/lib/rexml/parsers/xpathparser.rb index 7cca0975..faf373c8 100644 --- a/lib/rexml/parsers/xpathparser.rb +++ b/lib/rexml/parsers/xpathparser.rb @@ -14,7 +14,6 @@ class XPathParser # :nodoc: LITERAL = /^'([^']*)'|^"([^"]*)"/u def namespaces=( namespaces ) - Functions::namespace_context = namespaces @namespaces = namespaces end diff --git a/lib/rexml/xpath_parser.rb b/lib/rexml/xpath_parser.rb index 761b5281..996aaaaf 100644 --- a/lib/rexml/xpath_parser.rb +++ b/lib/rexml/xpath_parser.rb @@ -73,14 +73,11 @@ def initialize(strict: false) end def namespaces=( namespaces={} ) - @functions.namespace_context = namespaces @namespaces = namespaces end def variables=(vars) - vars = vars.transform_values { |v| coerce_variable(v) } - @functions.variables = vars - @variables = vars + @variables = vars.transform_values { |v| coerce_variable(v) } end def parse path, node