mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/psych/lib/psych/visitors/to_ruby.rb: Handle nil tags specially
to avoid slow method_missing calls. Thanks Kevin Menard! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ec3056ae22
commit
b3fb872d9d
2 changed files with 14 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Tue Oct 23 06:12:39 2012 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
|
* ext/psych/lib/psych/visitors/to_ruby.rb: Handle nil tags specially
|
||||||
|
to avoid slow method_missing calls. Thanks Kevin Menard!
|
||||||
|
|
||||||
Tue Oct 23 06:07:57 2012 Aaron Patterson <aaron@tenderlovemaking.com>
|
Tue Oct 23 06:07:57 2012 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
* ext/psych/lib/psych/scalar_scanner.rb: Ignore bad timestamps. If
|
* ext/psych/lib/psych/scalar_scanner.rb: Ignore bad timestamps. If
|
||||||
|
|
|
@ -118,6 +118,8 @@ module Psych
|
||||||
end
|
end
|
||||||
|
|
||||||
case o.tag
|
case o.tag
|
||||||
|
when nil
|
||||||
|
register_empty(o)
|
||||||
when '!omap', 'tag:yaml.org,2002:omap'
|
when '!omap', 'tag:yaml.org,2002:omap'
|
||||||
map = register(o, Psych::Omap.new)
|
map = register(o, Psych::Omap.new)
|
||||||
o.children.each { |a|
|
o.children.each { |a|
|
||||||
|
@ -130,9 +132,7 @@ module Psych
|
||||||
o.children.each { |c| list.push accept c }
|
o.children.each { |c| list.push accept c }
|
||||||
list
|
list
|
||||||
else
|
else
|
||||||
list = register(o, [])
|
register_empty(o)
|
||||||
o.children.each { |c| list.push accept c }
|
|
||||||
list
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -252,6 +252,12 @@ module Psych
|
||||||
object
|
object
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def register_empty object
|
||||||
|
list = register(object, [])
|
||||||
|
object.children.each { |c| list.push accept c }
|
||||||
|
list
|
||||||
|
end
|
||||||
|
|
||||||
def revive_hash hash, o
|
def revive_hash hash, o
|
||||||
@st[o.anchor] = hash if o.anchor
|
@st[o.anchor] = hash if o.anchor
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue