diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-07 16:58:10 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-07 16:58:10 +0000 |
commit | db70e477d310d9daf8f22b009521fcd67fec0205 (patch) | |
tree | 73778b242ce07f61ed0861409e473888251b056f /ext/psych/lib | |
parent | c5942b91a2812cae59878b5e0d4ecf7c0e41cfdc (diff) | |
download | ruby-db70e477d310d9daf8f22b009521fcd67fec0205.tar.gz |
* ext/psych/*: update psych to 2.0.16
* test/psych/*: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/lib')
-rw-r--r-- | ext/psych/lib/psych.rb | 2 | ||||
-rw-r--r-- | ext/psych/lib/psych/visitors/to_ruby.rb | 3 | ||||
-rw-r--r-- | ext/psych/lib/psych/visitors/yaml_tree.rb | 34 |
3 files changed, 16 insertions, 23 deletions
diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb index 1a3cb65ebc..8ba6ef6cc7 100644 --- a/ext/psych/lib/psych.rb +++ b/ext/psych/lib/psych.rb @@ -223,7 +223,7 @@ require 'psych/class_loader' module Psych # The version is Psych you're using - VERSION = '2.0.15' + VERSION = '2.0.16' # The version of libyaml Psych is using LIBYAML_VERSION = Psych.libyaml_version.join '.' diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index ea3ab1c479..4c3591b373 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -330,12 +330,13 @@ module Psych list end + SHOVEL = '<<' def revive_hash hash, o o.children.each_slice(2) { |k,v| key = accept(k) val = accept(v) - if key == '<<' && k.tag != "tag:yaml.org,2002:str" + if key == SHOVEL && k.tag != "tag:yaml.org,2002:str" case v when Nodes::Alias, Nodes::Mapping begin diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index 3087a4db1c..6ad30d2683 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/lib/psych/visitors/yaml_tree.rb @@ -70,6 +70,14 @@ module Psych @ss = ss @options = options @line_width = options[:line_width] + if @line_width && @line_width < 0 + if @line_width == -1 + # Treat -1 as unlimited line-width, same as libyaml does. + @line_width = nil + else + fail(ArgumentError, "Invalid line_width #{@line_width}, must be non-negative or -1 for unlimited.") + end + end @coders = [] @dispatch_cache = Hash.new do |h,klass| @@ -510,27 +518,11 @@ module Psych def dump_list o end - # '%:z' was no defined until 1.9.3 - if RUBY_VERSION < '1.9.3' - def format_time time - formatted = time.strftime("%Y-%m-%d %H:%M:%S.%9N") - - if time.utc? - formatted += " Z" - else - zone = time.strftime('%z') - formatted += " #{zone[0,3]}:#{zone[3,5]}" - end - - formatted - end - else - def format_time time - if time.utc? - time.strftime("%Y-%m-%d %H:%M:%S.%9N Z") - else - time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z") - end + def format_time time + if time.utc? + time.strftime("%Y-%m-%d %H:%M:%S.%9N Z") + else + time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z") end end |