Object
# File lib/mail/version_specific/ruby_1_8.rb, line 46 def Ruby18.b_value_decode(str) match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/) if match encoding = match[1] str = Ruby18.decode_base64(match[2]) end str end
# File lib/mail/version_specific/ruby_1_8.rb, line 39 def Ruby18.b_value_encode(str, encoding) # Ruby 1.8 requires an encoding to work raise ArgumentError, "Must supply an encoding" if encoding.nil? encoding = encoding.to_s.upcase.gsub('_', '-') [Encodings::Base64.encode(str), encoding] end
# File lib/mail/version_specific/ruby_1_8.rb, line 23 def Ruby18.decode_base64(str) Base64.decode64(str) end
# File lib/mail/version_specific/ruby_1_8.rb, line 27 def Ruby18.encode_base64(str) Base64.encode64(str) end
Escapes any parenthesis in a string that are unescaped. This can’t use the Ruby 1.9.1 regexp feature of negative look behind so we have to do two replacement, first unescape everything, then re-escape it
# File lib/mail/version_specific/ruby_1_8.rb, line 8 def Ruby18.escape_paren( str ) re = /\\\)/ str = str.gsub(re) { |s| ')'} re = /\\\(/ str = str.gsub(re) { |s| '('} re = /([\(\)])/ # Only match unescaped parens str.gsub(re) { |s| '\' + s } end
# File lib/mail/version_specific/ruby_1_8.rb, line 35 def Ruby18.get_constant(klass, string) klass.const_get( string ) end
# File lib/mail/version_specific/ruby_1_8.rb, line 31 def Ruby18.has_constant?(klass, string) klass.constants.include?( string ) end
# File lib/mail/version_specific/ruby_1_8.rb, line 71 def Ruby18.param_decode(str, encoding) URI.unescape(str) end
# File lib/mail/version_specific/ruby_1_8.rb, line 75 def Ruby18.param_encode(str) encoding = $KCODE.to_s.downcase language = Mail::Configuration.instance.param_encode_language "#{encoding}'#{language}'#{URI.escape(str)}" end
# File lib/mail/version_specific/ruby_1_8.rb, line 17 def Ruby18.paren( str ) str = $1 if str =~ /^\((.*)?\)$/ str = escape_paren( str ) '(' + str + ')' end
# File lib/mail/version_specific/ruby_1_8.rb, line 62 def Ruby18.q_value_decode(str) match = str.match(/\=\?(.+)?\?[Qq]\?(.+)?\?\=/) if match encoding = match[1] str = Encodings::QuotedPrintable.decode(match[2]) end str end
# File lib/mail/version_specific/ruby_1_8.rb, line 55 def Ruby18.q_value_encode(str, encoding) # Ruby 1.8 requires an encoding to work raise ArgumentError, "Must supply an encoding" if encoding.nil? encoding = encoding.to_s.upcase.gsub('_', '-') [Encodings::QuotedPrintable.encode(str), encoding] end
Generated with the Darkfish Rdoc Generator 2.