diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-17 08:59:54 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-17 08:59:54 +0000 |
commit | b6cd104ad49384a8f4641ea8bbb847fbf71f30de (patch) | |
tree | 6fb34e5e7134896756e57a361fd04f2780ed6881 /lib | |
parent | 6d319eb76881e06ab33397a50f9833fe65dc4d28 (diff) | |
download | ruby-b6cd104ad49384a8f4641ea8bbb847fbf71f30de.tar.gz ruby-b6cd104ad49384a8f4641ea8bbb847fbf71f30de.tar.xz ruby-b6cd104ad49384a8f4641ea8bbb847fbf71f30de.zip |
* lib/irb/xmp.rb: multilingualizes XMP::StringInputMethod.
[ruby-core:21383].
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb/xmp.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/irb/xmp.rb b/lib/irb/xmp.rb index 851852cd3..af87b4888 100644 --- a/lib/irb/xmp.rb +++ b/lib/irb/xmp.rb @@ -72,8 +72,20 @@ class XMP 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 |