aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-08 16:10:10 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-08 16:10:10 +0000
commita5dec230451cfbfa5df77c2d9f7e8dc5d8c568e4 (patch)
treeb2bcfd08c314993ee617aa065546917623d103b3
parent8d44c908cac7981e7e8d386c2095f3f559437e14 (diff)
downloadruby-a5dec230451cfbfa5df77c2d9f7e8dc5d8c568e4.tar.gz
* ext/psych/lib/psych/visitors/emitter.rb (initialize): line_width is
a valid option passed to the emitter. * test/psych/test_psych.rb: corresponding tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--ext/psych/lib/psych/visitors/emitter.rb1
-rw-r--r--test/psych/test_psych.rb5
3 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index aa56fd3141..4a1e1debb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Jul 9 01:08:46 2010 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/emitter.rb (initialize): line_width is
+ a valid option passed to the emitter.
+
+ * test/psych/test_psych.rb: corresponding tests.
+
Fri Jul 9 00:49:46 2010 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/emitter.c (line_width, set_line_width): preferred line may
diff --git a/ext/psych/lib/psych/visitors/emitter.rb b/ext/psych/lib/psych/visitors/emitter.rb
index c84629f9d0..30db17612d 100644
--- a/ext/psych/lib/psych/visitors/emitter.rb
+++ b/ext/psych/lib/psych/visitors/emitter.rb
@@ -5,6 +5,7 @@ module Psych
@handler = Psych::Emitter.new io
@handler.indentation = options[:indentation] if options[:indentation]
@handler.canonical = options[:canonical] if options[:canonical]
+ @handler.line_width = options[:line_width] if options[:line_width]
end
def visit_Psych_Nodes_Stream o
diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb
index 42b30a0c97..81fcccccd4 100644
--- a/test/psych/test_psych.rb
+++ b/test/psych/test_psych.rb
@@ -8,6 +8,11 @@ class TestPsych < Psych::TestCase
Psych.domain_types.clear
end
+ def test_line_width
+ yml = Psych.dump('123456 7', { :line_width => 5 })
+ assert_match(/^\s*7/, yml)
+ end
+
def test_indent
yml = Psych.dump({:a => {'b' => 'c'}}, {:indentation => 5})
assert_match(/^[ ]{5}b/, yml)