# File lib/mail/version_specific/ruby_1_8.rb, line 63 63: def Ruby18.b_value_decode(str) 64: match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/) 65: if match 66: encoding = match[1] 67: str = Ruby18.decode_base64(match[2]) 68: end 69: str 70: end
# File lib/mail/version_specific/ruby_1_8.rb, line 56 56: def Ruby18.b_value_encode(str, encoding) 57: # Ruby 1.8 requires an encoding to work 58: raise ArgumentError, "Must supply an encoding" if encoding.nil? 59: encoding = encoding.to_s.upcase.gsub('_', '-') 60: [Encodings::Base64.encode(str), encoding] 61: end
# File lib/mail/version_specific/ruby_1_8.rb, line 34 34: def Ruby18.bracket( str ) 35: str = $1 if str =~ /^\<(.*)?\>$/ 36: str = escape_bracket( str ) 37: '<' + str + '>' 38: end
# File lib/mail/version_specific/ruby_1_8.rb, line 40 40: def Ruby18.decode_base64(str) 41: Base64.decode64(str) if str 42: end
# File lib/mail/version_specific/ruby_1_8.rb, line 44 44: def Ruby18.encode_base64(str) 45: Base64.encode64(str) 46: end
# File lib/mail/version_specific/ruby_1_8.rb, line 25 25: def Ruby18.escape_bracket( str ) 26: re = /\\\>/ 27: str = str.gsub(re) { |s| '>'} 28: re = /\\\</ 29: str = str.gsub(re) { |s| '<'} 30: re = /([\<\>])/ # Only match unescaped parens 31: str.gsub(re) { |s| '\' + s } 32: 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 10 10: def Ruby18.escape_paren( str ) 11: re = /\\\)/ 12: str = str.gsub(re) { |s| ')'} 13: re = /\\\(/ 14: str = str.gsub(re) { |s| '('} 15: re = /([\(\)])/ # Only match unescaped parens 16: str.gsub(re) { |s| '\' + s } 17: end
# File lib/mail/version_specific/ruby_1_8.rb, line 52 52: def Ruby18.get_constant(klass, string) 53: klass.const_get( string ) 54: end
# File lib/mail/version_specific/ruby_1_8.rb, line 48 48: def Ruby18.has_constant?(klass, string) 49: klass.constants.include?( string ) 50: end
# File lib/mail/version_specific/ruby_1_8.rb, line 88 88: def Ruby18.param_decode(str, encoding) 89: URI.unescape(str) 90: end
# File lib/mail/version_specific/ruby_1_8.rb, line 92 92: def Ruby18.param_encode(str) 93: encoding = $KCODE.to_s.downcase 94: language = Configuration.instance.param_encode_language 95: "#{encoding}'#{language}'#{URI.escape(str)}" 96: end
# File lib/mail/version_specific/ruby_1_8.rb, line 19 19: def Ruby18.paren( str ) 20: str = $1 if str =~ /^\((.*)?\)$/ 21: str = escape_paren( str ) 22: '(' + str + ')' 23: end
# File lib/mail/version_specific/ruby_1_8.rb, line 79 79: def Ruby18.q_value_decode(str) 80: match = str.match(/\=\?(.+)?\?[Qq]\?(.+)?\?\=/) 81: if match 82: encoding = match[1] 83: str = Encodings::QuotedPrintable.decode(match[2].gsub(/_/, '=20')) 84: end 85: str 86: end
# File lib/mail/version_specific/ruby_1_8.rb, line 72 72: def Ruby18.q_value_encode(str, encoding) 73: # Ruby 1.8 requires an encoding to work 74: raise ArgumentError, "Must supply an encoding" if encoding.nil? 75: encoding = encoding.to_s.upcase.gsub('_', '-') 76: [Encodings::QuotedPrintable.encode(str), encoding] 77: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.