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