FIXME: This class can handle only (euc-jp/shift_jis -> iso-2022-jp).

Methods
D
E
H
K
L
M
N
P
R
S
T
W
Included Modules
Constants
BENCODE_DEBUG = false unless defined?(BENCODE_DEBUG)
 
SPACER = "\t"
 
MAX_LINE_LEN = 70
 
OPTIONS = { 'EUC' => '-Ej -m0', 'SJIS' => '-Sj -m0', 'UTF8' => nil, # FIXME 'NONE' => nil }
 
METHOD_ID = { ?jj => :extract_J, ?ee => :extract_E, ?aa => :extract_A, ?ss => :extract_S }
 
Class Public methods
encode( str )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 172
def Encoder.encode( str )
  e = new()
  e.header_body str
  e.terminate
  e.dest.string
end
new( dest = nil, encoding = nil, eol = "\r\n", limit = nil )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 189
def initialize( dest = nil, encoding = nil, eol = "\r\n", limit = nil )
  @f = StrategyInterface.create_dest(dest)
  @opt = OPTIONS[$KCODE]
  @eol = eol
  reset
end
Instance Public methods
dest()
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 214
def dest
  @f
end
encode_value( str )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 288
def encode_value( str )
  str.gsub(TOKEN_UNSAFE) {|s| '%%%02x' % s[0] }
end
header_body( str )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 241
def header_body( str )
  scanadd normalize_encoding(str)
end
header_line( line )

add

# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 231
def header_line( line )
  scanadd line
end
header_name( name )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 235
def header_name( name )
  add_text name.split(%r-/).map {|i| i.capitalize }.join('-')
  add_text ':'
  add_lwsp ' '
end
kv_pair( k, v )

FIXME: implement line folding

# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 274
def kv_pair( k, v )
  return if v.nil?
  v = normalize_encoding(v)
  if token_safe?(v)
    add_text k + '=' + v
  elsif not CONTROL_CHAR === v
    add_text k + '=' + quote_token(v)
  else
    # apply RFC2231 encoding
    kv = k + '*=' + "iso-2022-jp'ja'" + encode_value(v)
    add_text kv
  end
end
lwsp( str )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 251
def lwsp( str )
  add_lwsp str.sub(%r[\r\n]+[^\r\n]*\z/, '')
end
meta( str )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 255
def meta( str )
  add_text str
end
normalize_encoding( str )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 196
def normalize_encoding( str )
  if @opt
  then NKF.nkf(@opt, str)
  else str
  end
end
phrase( str )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 263
def phrase( str )
  str = normalize_encoding(str)
  if CONTROL_CHAR === str
    scanadd str
  else
    add_text quote_phrase(str)
  end
end
puts( str = nil )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 218
def puts( str = nil )
  @f << str if str
  @f << @eol
end
reset()
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 203
def reset
  @text = ''
  @lwsp = ''
  @curlen = 0
end
space()
Also aliased as: spc
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 245
def space
  add_lwsp ' '
end
spc()
terminate()
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 209
def terminate
  add_lwsp ''
  reset
end
text( str )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 259
def text( str )
  scanadd normalize_encoding(str)
end
write( str )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb, line 223
def write( str )
  @f << str
end