Use Symbol#equal? instead of Symbol#==
At least on JRuby and Rubinius this can be quite a bit faster. On MRI the difference is not really significant.
This commit is contained in:
parent
5c7c4a6110
commit
ecdeeacd76
|
@ -668,7 +668,7 @@ even
|
||||||
# @return [TrueClass|FalseClass]
|
# @return [TrueClass|FalseClass]
|
||||||
#
|
#
|
||||||
def int_node?(node)
|
def int_node?(node)
|
||||||
return node.type == :int
|
return node.type.equal?(:int)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -83,7 +83,7 @@ module Oga
|
||||||
# @return [TrueClass|FalseClass]
|
# @return [TrueClass|FalseClass]
|
||||||
#
|
#
|
||||||
def html?
|
def html?
|
||||||
return type == :html
|
return type.equal?(:html)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -1640,7 +1640,7 @@ module Oga
|
||||||
def node_matches?(xml_node, ast_node)
|
def node_matches?(xml_node, ast_node)
|
||||||
ns, name = *ast_node.children
|
ns, name = *ast_node.children
|
||||||
|
|
||||||
if ast_node.type == :type_test
|
if ast_node.type.equal?(:type_test)
|
||||||
return type_matches?(xml_node, ast_node)
|
return type_matches?(xml_node, ast_node)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ path_step
|
||||||
args = val[1][1]
|
args = val[1][1]
|
||||||
pred = val[1][2]
|
pred = val[1][2]
|
||||||
|
|
||||||
if type == :test
|
if type.equal?(:test)
|
||||||
# Whenever a bare test is used (e.g. just "A") this actually means
|
# Whenever a bare test is used (e.g. just "A") this actually means
|
||||||
# "child::A". Handling this on parser level is the easiest.
|
# "child::A". Handling this on parser level is the easiest.
|
||||||
if args
|
if args
|
||||||
|
|
Loading…
Reference in New Issue