[DRE-commits] [ruby-soap4r] 02/04: Ignore Ruby 1.8
Antonio Terceiro
terceiro at alioth.debian.org
Sun Sep 8 12:26:45 UTC 2013
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to branch master
in repository ruby-soap4r.
commit 85bdf1d157d126dbffaa1d37fdf2c13e7fe736ef
Author: Antonio Terceiro <terceiro at debian.org>
Date: Thu Aug 15 11:27:21 2013 +0200
Ignore Ruby 1.8
---
lib/xsd/iconvcharset.rb | 20 --------------------
test/xsd/test_iconvcharset.rb | 2 +-
2 files changed, 1 insertion(+), 21 deletions(-)
diff --git a/lib/xsd/iconvcharset.rb b/lib/xsd/iconvcharset.rb
index 7b796c4..7901098 100644
--- a/lib/xsd/iconvcharset.rb
+++ b/lib/xsd/iconvcharset.rb
@@ -7,26 +7,6 @@
module XSD
-
-class IconvCharset
- require 'iconv'
- def self.safe_iconv(to, from, str)
- iconv = Iconv.new(to, from)
- out = ""
- begin
- out << iconv.iconv(str)
- rescue Iconv::IllegalSequence => e
- out << e.success
- ch, str = e.failed.split(//, 2)
- out << '?'
- warn("Failed to convert #{ch}")
- retry
- end
- return out
- end
-end if RUBY_VERSION < '1.9'
-
-
class IconvCharset
def self.safe_iconv(to, from, str)
str.force_encoding(from).chars.map { |c| c.valid_encoding? && c || '?' }.join.encode(to)
diff --git a/test/xsd/test_iconvcharset.rb b/test/xsd/test_iconvcharset.rb
index 2c0f66f..452291c 100644
--- a/test/xsd/test_iconvcharset.rb
+++ b/test/xsd/test_iconvcharset.rb
@@ -17,4 +17,4 @@ class TestIconvCharset < Test::Unit::TestCase
assert_equal "á?á".encode('iso-8859-1'), XSD::IconvCharset.safe_iconv("iso-8859-1", "utf-8", "á\x8Dá".force_encoding('ascii-8bit'))
end
-end
+end if RUBY_VERSION > '1.9'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-soap4r.git
More information about the Pkg-ruby-extras-commits
mailing list