Enforce symbols for element attributes.

This comes with a little bit of memory overhead but this should be minor in
most cases.
This commit is contained in:
Yorick Peterse committed 2014-05-15 01:04:26 +02:00
1 parent f4b9bbd4ac
commit 723a273e4f
5 files changed
+7 -7

No files matched your search

+1 -1
View File
@@ -41,7 +41,7 @@ module Oga
# @return [String]
#
def attribute(name)
return attributes[name]
return attributes[name.to_sym]
end
alias_method :attr, :attribute
+2 -2
View File
@@ -137,10 +137,10 @@ rule
attribute
# foo
: T_ATTR { {val[0] => nil} }
: T_ATTR { {val[0].to_sym => nil} }
# foo="bar"
| T_ATTR T_STRING { {val[0] => val[1]} }
| T_ATTR T_STRING { {val[0].to_sym => val[1]} }
;
# XML declarations