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 89
89: def self.decode( str, encoding = nil )
90: encoding ||= (OUTPUT_ENCODING[$KCODE] || 'j')
91: opt = '-m' + encoding
92: str.gsub(ENCODED_WORDS) {|s| NKF.nkf(opt, s) }
93: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 95
95: def initialize( dest, encoding = nil, eol = "\n" )
96: @f = StrategyInterface.create_dest(dest)
97: @encoding = (/\A[ejs]/ === encoding) ? encoding[0,1] : nil
98: @eol = eol
99: end
Public Instance methods
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 117
117: def header_body( str )
118: @f << decode(str)
119: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 109
109: def header_line( str )
110: @f << decode(str)
111: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 113
113: def header_name( nm )
114: @f << nm << ': '
115: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 143
143: def kv_pair( k, v )
144: @f << k << '=' << v
145: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 127
127: def lwsp( str )
128: @f << str
129: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 131
131: def meta( str )
132: @f << str
133: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 139
139: def phrase( str )
140: @f << quote_phrase(decode(str))
141: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 147
147: def puts( str = nil )
148: @f << str if str
149: @f << @eol
150: end
This method is also aliased as
spc
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 121
121: def space
122: @f << ' '
123: end
Alias for space
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 106
106: def terminate
107: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 135
135: def text( str )
136: @f << decode(str)
137: end
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 152
152: def write( str )
153: @f << str
154: end
Private Instance methods
[ show source ]
# File lib/action_mailer/vendor/tmail/encode.rb, line 101
101: def decode( str )
102: self.class.decode(str, @encoding)
103: end