Don't use Namespace#to_s when matching namespaces

This is a waste of time as it allocates a new String on every call.
This commit is contained in:
Yorick Peterse 2015-05-07 01:04:03 +02:00
parent b9145d83f8
commit 0298e7068c
1 changed files with 3 additions and 1 deletions

View File

@ -1702,7 +1702,9 @@ module Oga
def namespace_matches?(xml_node, ns)
return false unless xml_node.respond_to?(:namespace)
return ns == STAR ? true : xml_node.namespace.to_s == ns
return true if ns == STAR
return xml_node.namespace && xml_node.namespace.name == ns
end
##