[前][次][番号順一覧][スレッド一覧]

ruby-changes:16594

From: tenderlove <ko1@a...>
Date: Fri, 9 Jul 2010 01:13:16 +0900 (JST)
Subject: [ruby-changes:16594] Ruby:r28586 (trunk): * ext/psych/lib/psych/visitors/emitter.rb (initialize): line_width is

tenderlove	2010-07-09 01:10:10 +0900 (Fri, 09 Jul 2010)

  New Revision: 28586

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28586

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/ext/psych/lib/psych/visitors/emitter.rb
    trunk/test/psych/test_psych.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28585)
+++ ChangeLog	(revision 28586)
@@ -1,3 +1,10 @@
+Fri Jul  9 01:08:46 2010  Aaron Patterson <aaron@t...>
+
+	* 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@t...>
 
 	* ext/psych/emitter.c (line_width, set_line_width): preferred line may
Index: ext/psych/lib/psych/visitors/emitter.rb
===================================================================
--- ext/psych/lib/psych/visitors/emitter.rb	(revision 28585)
+++ ext/psych/lib/psych/visitors/emitter.rb	(revision 28586)
@@ -5,6 +5,7 @@
         @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
Index: test/psych/test_psych.rb
===================================================================
--- test/psych/test_psych.rb	(revision 28585)
+++ test/psych/test_psych.rb	(revision 28586)
@@ -8,6 +8,11 @@
     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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]