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

ruby-changes:10082

From: yugui <ko1@a...>
Date: Sat, 17 Jan 2009 18:00:16 +0900 (JST)
Subject: [ruby-changes:10082] Ruby:r21625 (trunk): * lib/irb/xmp.rb: multilingualizes XMP::StringInputMethod.

yugui	2009-01-17 17:59:54 +0900 (Sat, 17 Jan 2009)

  New Revision: 21625

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

  Log:
    * lib/irb/xmp.rb: multilingualizes XMP::StringInputMethod.
      [ruby-core:21383].

  Modified files:
    trunk/ChangeLog
    trunk/lib/irb/xmp.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21624)
+++ ChangeLog	(revision 21625)
@@ -1,3 +1,8 @@
+Sat Jan 17 17:58:22 2009  Yuki Sonoda (Yugui)  <yugui@y...>
+
+	* lib/irb/xmp.rb: multilingualizes XMP::StringInputMethod.
+	  [ruby-core:21383].
+
 Sat Jan 17 15:01:22 2009  Tanaka Akira  <akr@f...>
 
 	* ext/socket/raddrinfo.c (make_inspectname): add a res argument to
Index: lib/irb/xmp.rb
===================================================================
--- lib/irb/xmp.rb	(revision 21624)
+++ lib/irb/xmp.rb	(revision 21625)
@@ -72,8 +72,20 @@
     end
 
     def puts(exps)
+      if @encoding and exps.encoding != @encoding
+	enc = Encoding.compatible?(@exps.join("\n"), exps)
+	if enc.nil?
+	  raise Encoding::CompatibilityError, "Encoding in which the passed exression is encoded is not compatible to the preceding's one"
+	else
+	  @encoding = enc
+	end
+      else
+	@encoding = exps.encoding
+      end
       @exps.concat exps.split(/\n/)
     end
+
+    attr_reader :encoding
   end
 end
 

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

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