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:
Yorick Peterse 2015-05-07 23:03:03 +02:00
parent 5c7c4a6110
commit ecdeeacd76
4 changed files with 4 additions and 4 deletions

View File

@ -668,7 +668,7 @@ even
# @return [TrueClass|FalseClass]
#
def int_node?(node)
return node.type == :int
return node.type.equal?(:int)
end
##

View File

@ -83,7 +83,7 @@ module Oga
# @return [TrueClass|FalseClass]
#
def html?
return type == :html
return type.equal?(:html)
end
##

View File

@ -1640,7 +1640,7 @@ module Oga
def node_matches?(xml_node, ast_node)
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)
end

View File

@ -134,7 +134,7 @@ path_step
args = val[1][1]
pred = val[1][2]
if type == :test
if type.equal?(:test)
# Whenever a bare test is used (e.g. just "A") this actually means
# "child::A". Handling this on parser level is the easiest.
if args