1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/psych/lib/psych/visitors/yaml_tree.rb (accept): use Hash#key?

when looking up object references to err on the side of cache
  misses.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2011-02-21 17:42:50 +00:00
parent 8b5a3b7d39
commit 846b8118df
2 changed files with 12 additions and 3 deletions

View file

@ -1,3 +1,9 @@
Tue Feb 22 02:41:51 2011 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/visitors/yaml_tree.rb (accept): use Hash#key?
when looking up object references to err on the side of cache
misses.
Mon Feb 21 10:58:39 2011 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/json/yaml_events.rb: refactoring JSON event

View file

@ -70,9 +70,12 @@ module Psych
def accept target
# return any aliases we find
if node = @st[target.object_id]
node.anchor = target.object_id.to_s
return @emitter.alias target.object_id.to_s
if @st.key? target.object_id
oid = target.object_id
node = @st[oid]
anchor = oid.to_s
node.anchor = oid
return @emitter.alias oid
end
if target.respond_to?(:to_yaml)