diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-12-07 08:48:38 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-12-07 08:48:38 -0800 |
commit | 4b6ad0880e8b19754f0d48f01baa85047d4714bf (patch) | |
tree | f43c30df829d739fa12bdf1156cdca684b49e55c /lib | |
parent | 5bd7744c7d551abf01f54a2a6a8a4f006cd198e3 (diff) | |
parent | cdebadbbcd2f0bac8e80bf7a179fa288a01c363e (diff) | |
download | psych-4b6ad0880e8b19754f0d48f01baa85047d4714bf.zip |
Merge pull request #255 from glebm/line_width
Fixes line width handling
Diffstat (limited to 'lib')
-rw-r--r-- | lib/psych/visitors/yaml_tree.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb index 63e14da..6ad30d2 100644 --- a/lib/psych/visitors/yaml_tree.rb +++ b/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| |