diff options
author | Alex Young <alex@bytemark.co.uk> | 2015-04-20 14:06:19 +0100 |
---|---|---|
committer | Alex Young <alex@bytemark.co.uk> | 2015-04-20 14:06:19 +0100 |
commit | 2ec8ca7efdab8b3246ba421ae4e9052702d398db (patch) | |
tree | 1bb822d54d311d8e980fcee6064b1257815ac695 /lib/mauve/sender.rb | |
parent | d92499d23bdb591ecbe824db3064ec4ab5e8f4f5 (diff) |
Get tests passing on ruby 2.0.0-p598
Diffstat (limited to 'lib/mauve/sender.rb')
-rw-r--r-- | lib/mauve/sender.rb | 29 |
1 files changed, 6 insertions, 23 deletions
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 |