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
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 73
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
67
68
69
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 67
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 52
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
45
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 45
alias newobj new
|
Instance Method Details
#accept(strategy, dummy1 = nil, dummy2 = nil) ⇒ Object
132
133
134
135
136
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 132
def accept( strategy, dummy1 = nil, dummy2 = nil )
ensure_parsed
do_accept strategy
strategy.terminate
end
|
#body ⇒ Object
117
118
119
120
121
122
123
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 117
def body
ensure_parsed
v = Decoder.new(s = '')
do_accept v
v.terminate
s
end
|
#body=(str) ⇒ Object
125
126
127
128
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 125
def body=( str )
@body = str
clear_parse_status
end
|
#empty? ⇒ Boolean
93
94
95
96
97
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 93
def empty?
ensure_parsed
return true if @illegal
isempty?
end
|
#illegal? ⇒ Boolean
89
90
91
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 89
def illegal?
@illegal
end
|
#inspect ⇒ Object
85
86
87
|
# File 'lib/action_mailer/vendor/tmail/header.rb', line 85
def inspect
"#<#{self.class} #{@body.inspect}>"
end
|