Parent

Class/Module Index [+]

Quicksearch

Mail::RubyVer

Public Class Methods

b_value_decode(str) click to toggle source
# File lib/mail/version_specific/ruby_1_9.rb, line 38
def Ruby19.b_value_decode(str)
  match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/)
  if match
    encoding = match[1]
    str = Ruby19.decode_base64(match[2])
    str.force_encoding(encoding)
  end
  str
end
b_value_encode(str, encoding = nil) click to toggle source
# File lib/mail/version_specific/ruby_1_9.rb, line 33
def Ruby19.b_value_encode(str, encoding = nil)
  encoding = str.encoding.to_s
  [Ruby19.encode_base64(str), encoding]
end
decode_base64(str) click to toggle source
# File lib/mail/version_specific/ruby_1_9.rb, line 17
def Ruby19.decode_base64(str)
  str.unpack( 'm' ).first.force_encoding(Encoding::BINARY)
end
encode_base64(str) click to toggle source
# File lib/mail/version_specific/ruby_1_9.rb, line 21
def Ruby19.encode_base64(str)
  [str].pack( 'm' )
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 6
def Ruby19.escape_paren( str )
  re = /(?<!\\)([\(\)])/          # Only match unescaped parens
  str.gsub(re) { |s| '\' + s }
end
get_constant(klass, string) click to toggle source
# File lib/mail/version_specific/ruby_1_9.rb, line 29
def Ruby19.get_constant(klass, string)
  klass.const_get( string.to_sym )
end
has_constant?(klass, string) click to toggle source
# File lib/mail/version_specific/ruby_1_9.rb, line 25
def Ruby19.has_constant?(klass, string)
  klass.constants.include?( string.to_sym )
end
param_decode(str, encoding) click to toggle source
# File lib/mail/version_specific/ruby_1_9.rb, line 63
def Ruby19.param_decode(str, encoding)
  string = URI.unescape(str)
  string.force_encoding(encoding) if encoding
  string
end
param_encode(str) click to toggle source
# File lib/mail/version_specific/ruby_1_9.rb, line 69
def Ruby19.param_encode(str)
  encoding = str.encoding.to_s.downcase
  language = Mail::Configuration.instance.param_encode_language
  "#{encoding}'#{language}'#{URI.escape(str)}"
end
paren( str ) click to toggle source
# File lib/mail/version_specific/ruby_1_9.rb, line 11
def Ruby19.paren( str )
  str = $1 if str =~ /^\((.*)?\)$/
  str = escape_paren( str )
  '(' + str + ')'
end
q_value_decode(str) click to toggle source
# File lib/mail/version_specific/ruby_1_9.rb, line 53
def Ruby19.q_value_decode(str)
  match = str.match(/\=\?(.+)?\?[Qq]\?(.+)?\?\=/)
  if match
    encoding = match[1]
    str = Encodings::QuotedPrintable.decode(match[2])
    str.force_encoding(encoding)
  end
  str
end
q_value_encode(str, encoding = nil) click to toggle source
# File lib/mail/version_specific/ruby_1_9.rb, line 48
def Ruby19.q_value_encode(str, encoding = nil)
  encoding = str.encoding.to_s
  [Encodings::QuotedPrintable.encode(str), encoding]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.