Class: TMail::HeaderField
- Inherits:
-
Object
- Object
- TMail::HeaderField
show all
- Includes:
- StrategyInterface, TextUtils
- Defined in:
- lib/action_mailer/vendor/tmail/header.rb,
lib/action_mailer/vendor/tmail/header.rb
Overview
Constant Summary
collapse
- FNAME_TO_CLASS =
{
'date' => DateTimeHeader,
'resent-date' => DateTimeHeader,
'to' => AddressHeader,
'cc' => AddressHeader,
'bcc' => AddressHeader,
'from' => AddressHeader,
'reply-to' => AddressHeader,
'resent-to' => AddressHeader,
'resent-cc' => AddressHeader,
'resent-bcc' => AddressHeader,
'resent-from' => AddressHeader,
'resent-reply-to' => AddressHeader,
'sender' => SingleAddressHeader,
'resent-sender' => SingleAddressHeader,
'return-path' => ReturnPathHeader,
'message-id' => MessageIdHeader,
'resent-message-id' => MessageIdHeader,
'in-reply-to' => ReferencesHeader,
'received' => ReceivedHeader,
'references' => ReferencesHeader,
'keywords' => KeywordsHeader,
'encrypted' => EncryptedHeader,
'mime-version' => MimeVersionHeader,
'content-type' => ContentTypeHeader,
'content-transfer-encoding' => ContentTransferEncodingHeader,
'content-disposition' => ContentDispositionHeader,
'content-id' => MessageIdHeader,
'subject' => UnstructuredHeader,
'comments' => UnstructuredHeader,
'content-description' => UnstructuredHeader
}
Constants included
from TextUtils
TextUtils::ATOM_UNSAFE, TextUtils::CONTROL_CHAR, TextUtils::MESSAGE_ID, TextUtils::MIME_ENCODED, TextUtils::MONTH, TextUtils::NKF_FLAGS, TextUtils::PHRASE_UNSAFE, TextUtils::RFC2231_ENCODED, TextUtils::TOKEN_UNSAFE, TextUtils::WDAY, TextUtils::ZONESTR_TABLE
Class Method Summary
collapse
Instance Method Summary
collapse
#accept_strategy, create_dest, #decoded, #encoded
Methods included from TextUtils
#atom_safe?, #decode_RFC2231, #decode_params, #join_domain, #message_id?, #mime_encoded?, #quote_atom, #quote_phrase, #quote_token, #time2str, #timezone_string_to_unixtime, #to_kcode, #token_safe?
Constructor Details
#initialize(body, conf, intern = false) ⇒ HeaderField
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 54
def initialize( body, conf, intern = false )
@body = body
@config = conf
@illegal = false
@parsed = false
if intern
@parsed = true
parse_init
end
end
|
Class Method Details
.internal_new(name, conf) ⇒ Object
48
49
50
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 48
def internal_new( name, conf )
FNAME_TO_CLASS[name].newobj('', conf, true)
end
|
.new(name, body, conf = DEFAULT_CONFIG) ⇒ Object
.new_from_port(port, name, conf = DEFAULT_CONFIG) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 33
def new_from_port( port, name, conf = DEFAULT_CONFIG )
re = Regep.new('\A(' + Regexp.quote(name) + '):', 'i')
str = nil
port.ropen {|f|
f.each do |line|
if m = re.match(line) then str = m.post_match.strip
elsif str and /\A[\t ]/ === line then str << ' ' << line.strip
elsif /\A-*\s*\z/ === line then break
elsif str then break
end
end
}
new(name, str, Config.to_config(conf))
end
|
.newobj ⇒ Object
26
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 26
alias newobj new
|
Instance Method Details
#accept(strategy, dummy1 = nil, dummy2 = nil) ⇒ Object
113
114
115
116
117
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 113
def accept( strategy, dummy1 = nil, dummy2 = nil )
ensure_parsed
do_accept strategy
strategy.terminate
end
|
#body ⇒ Object
98
99
100
101
102
103
104
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 98
def body
ensure_parsed
v = Decoder.new(s = '')
do_accept v
v.terminate
s
end
|
#body=(str) ⇒ Object
106
107
108
109
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 106
def body=( str )
@body = str
clear_parse_status
end
|
#empty? ⇒ Boolean
74
75
76
77
78
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 74
def empty?
ensure_parsed
return true if @illegal
isempty?
end
|
#illegal? ⇒ Boolean
70
71
72
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 70
def illegal?
@illegal
end
|
#inspect ⇒ Object
66
67
68
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 66
def inspect
"#<#{self.class} #{@body.inspect}>"
end
|