Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 1 addition & 13 deletions lib/rexml/functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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
1 change: 0 additions & 1 deletion lib/rexml/parsers/xpathparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class XPathParser # :nodoc:
LITERAL = /^'([^']*)'|^"([^"]*)"/u

def namespaces=( namespaces )
Functions::namespace_context = namespaces
@namespaces = namespaces
end

Expand Down
5 changes: 1 addition & 4 deletions lib/rexml/xpath_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading