MIME B encoding decoder
Methods
- decode
- decode
- header_body
- header_line
- header_name
- kv_pair
- lwsp
- meta
- new
- phrase
- puts
- space
- spc
- terminate
- text
- write
Included Modules
Constants
| ENCODED_WORDS | = | /#{encoded}(?:\s+#{encoded})*/i |
| OUTPUT_ENCODING | = | { 'EUC' => 'e', 'SJIS' => 's', } |
Public Class methods
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 70
70: def self.decode( str, encoding = nil )
71: encoding ||= (OUTPUT_ENCODING[$KCODE] || 'j')
72: opt = '-m' + encoding
73: str.gsub(ENCODED_WORDS) {|s| NKF.nkf(opt, s) }
74: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 76
76: def initialize( dest, encoding = nil, eol = "\n" )
77: @f = StrategyInterface.create_dest(dest)
78: @encoding = (/\A[ejs]/ === encoding) ? encoding[0,1] : nil
79: @eol = eol
80: end
Public Instance methods
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 98
98: def header_body( str )
99: @f << decode(str)
100: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 90
90: def header_line( str )
91: @f << decode(str)
92: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 94
94: def header_name( nm )
95: @f << nm << ': '
96: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 124
124: def kv_pair( k, v )
125: @f << k << '=' << v
126: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 108
108: def lwsp( str )
109: @f << str
110: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 112
112: def meta( str )
113: @f << str
114: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 120
120: def phrase( str )
121: @f << quote_phrase(decode(str))
122: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 128
128: def puts( str = nil )
129: @f << str if str
130: @f << @eol
131: end
This method is also aliased as
spc
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 102
102: def space
103: @f << ' '
104: end
Alias for space
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 87
87: def terminate
88: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 116
116: def text( str )
117: @f << decode(str)
118: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 133
133: def write( str )
134: @f << str
135: end
Private Instance methods
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 82
82: def decode( str )
83: self.class.decode(str, @encoding)
84: end