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:
parent
8b5a3b7d39
commit
846b8118df
2 changed files with 12 additions and 3 deletions
|
@ -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>
|
Mon Feb 21 10:58:39 2011 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
* ext/psych/lib/psych/json/yaml_events.rb: refactoring JSON event
|
* ext/psych/lib/psych/json/yaml_events.rb: refactoring JSON event
|
||||||
|
|
|
@ -70,9 +70,12 @@ module Psych
|
||||||
|
|
||||||
def accept target
|
def accept target
|
||||||
# return any aliases we find
|
# return any aliases we find
|
||||||
if node = @st[target.object_id]
|
if @st.key? target.object_id
|
||||||
node.anchor = target.object_id.to_s
|
oid = target.object_id
|
||||||
return @emitter.alias target.object_id.to_s
|
node = @st[oid]
|
||||||
|
anchor = oid.to_s
|
||||||
|
node.anchor = oid
|
||||||
|
return @emitter.alias oid
|
||||||
end
|
end
|
||||||
|
|
||||||
if target.respond_to?(:to_yaml)
|
if target.respond_to?(:to_yaml)
|
||||||
|
|
Loading…
Add table
Reference in a new issue