Parent

Class Index [+]

Quicksearch

Mail::Ruby19

Public Class Methods

b_value_decode(str) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 50
50:     def Ruby19.b_value_decode(str)
51:       match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/)
52:       if match
53:         encoding = match[1]
54:         str = Ruby19.decode_base64(match[2])
55:         str.force_encoding(encoding)
56:       end
57:       str
58:     end
b_value_encode(str, encoding = nil) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 45
45:     def Ruby19.b_value_encode(str, encoding = nil)
46:       encoding = str.encoding.to_s
47:       [Ruby19.encode_base64(str), encoding]
48:     end
bracket( str ) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 23
23:     def Ruby19.bracket( str )
24:       str = $1 if str =~ /^\<(.*)?\>$/
25:       str = escape_bracket( str )
26:       '<' + str + '>'
27:     end
decode_base64(str) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 29
29:     def Ruby19.decode_base64(str)
30:       str.unpack( 'm' ).first.force_encoding(Encoding::BINARY)
31:     end
encode_base64(str) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 33
33:     def Ruby19.encode_base64(str)
34:       [str].pack( 'm' )
35:     end
escape_bracket( str ) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 18
18:     def Ruby19.escape_bracket( str )
19:       re = /(?<!\\)([\<\>])/          # Only match unescaped brackets
20:       str.gsub(re) { |s| '\' + s }
21:     end
escape_paren( str ) click to toggle source

Escapes any parenthesis in a string that are unescaped this uses a Ruby 1.9.1 regexp feature of negative look behind

    # File lib/mail/version_specific/ruby_1_9.rb, line 7
 7:     def Ruby19.escape_paren( str )
 8:       re = /(?<!\\)([\(\)])/          # Only match unescaped parens
 9:       str.gsub(re) { |s| '\' + s }
10:     end
get_constant(klass, string) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 41
41:     def Ruby19.get_constant(klass, string)
42:       klass.const_get( string.to_sym )
43:     end
has_constant?(klass, string) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 37
37:     def Ruby19.has_constant?(klass, string)
38:       klass.constants.include?( string.to_sym )
39:     end
param_decode(str, encoding) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 75
75:     def Ruby19.param_decode(str, encoding)
76:       string = URI.unescape(str)
77:       string.force_encoding(encoding) if encoding
78:       string
79:     end
param_encode(str) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 81
81:     def Ruby19.param_encode(str)
82:       encoding = str.encoding.to_s.downcase
83:       language = Mail::Configuration.instance.param_encode_language
84:       "#{encoding}'#{language}'#{URI.escape(str)}"
85:     end
paren( str ) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 12
12:     def Ruby19.paren( str )
13:       str = $1 if str =~ /^\((.*)?\)$/
14:       str = escape_paren( str )
15:       '(' + str + ')'
16:     end
q_value_decode(str) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 65
65:     def Ruby19.q_value_decode(str)
66:       match = str.match(/\=\?(.+)?\?[Qq]\?(.+)?\?\=/)
67:       if match
68:         encoding = match[1]
69:         str = Encodings::QuotedPrintable.decode(match[2])
70:         str.force_encoding(encoding)
71:       end
72:       str
73:     end
q_value_encode(str, encoding = nil) click to toggle source
    # File lib/mail/version_specific/ruby_1_9.rb, line 60
60:     def Ruby19.q_value_encode(str, encoding = nil)
61:       encoding = str.encoding.to_s
62:       [Encodings::QuotedPrintable.encode(str), encoding]
63:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.