From 2ec8ca7efdab8b3246ba421ae4e9052702d398db Mon Sep 17 00:00:00 2001 From: Alex Young Date: Mon, 20 Apr 2015 14:06:19 +0100 Subject: Get tests passing on ruby 2.0.0-p598 --- lib/mauve/sender.rb | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) (limited to 'lib/mauve') diff --git a/lib/mauve/sender.rb b/lib/mauve/sender.rb index fe22471..e6cc4dd 100644 --- a/lib/mauve/sender.rb +++ b/lib/mauve/sender.rb @@ -7,12 +7,6 @@ rescue LoadError # Do nothing -- these are bonus libraries :) end -begin - require 'iconv' unless String.new.respond_to?(:encode) -rescue LoadError - # Do nothing -- these are bonus libraries :) -end - require 'mauve/mauve_resolv' require 'mauve/mauve_time' require 'mauve/proto' @@ -172,16 +166,10 @@ module Mauve # # Make sure all string fields are UTF8 -- to ensure the maximal amount of information is sent. # - if value.is_a?(String) - if value.respond_to?(:encode) - value = value.encode("UTF-8", :undef => :replace, :invalid => :replace) - elsif defined? Iconv - value = Iconv.conv("UTF-8//IGNORE", from_charset, value) - end - - update.__send__("#{field.name}=", value) + if value.respond_to?(:encode) + value = value.encode("UTF-8", :undef => :replace, :invalid => :replace) end - + update.__send__("#{field.name}=", value) end update.alert.each do |alert| @@ -194,15 +182,10 @@ module Mauve # # Make sure all string fields are UTF8 -- to ensure the maximal amount of information is sent. # - if value.is_a?(String) - if value.respond_to?(:encode) - value = value.encode("UTF-8", :undef => :replace, :invalid => :replace) - elsif defined? Iconv - value = Iconv.conv("UTF-8//IGNORE", from_charset, value) - end - - alert.__send__("#{field.name}=", value) + if value.respond_to?(:encode) + value = value.encode("UTF-8", :undef => :replace, :invalid => :replace) end + alert.__send__("#{field.name}=", value) end end -- cgit v1.2.1