Class: TMail::Address
Overview
Constant Summary
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
Instance Attribute Summary collapse
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(local, domain) ⇒ Address
Returns a new instance of Address.
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 48
def initialize( local, domain )
if domain
domain.each do |s|
raise SyntaxError, 'empty word in domain' if s.empty?
end
end
@local = local
@domain = domain
@name = nil
@routes = []
end
|
Instance Attribute Details
#name ⇒ Object
Also known as:
phrase
Returns the value of attribute name.
60
61
62
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 60
def name
@name
end
|
#routes ⇒ Object
Also known as:
route
Returns the value of attribute routes.
70
71
72
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 70
def routes
@routes
end
|
Class Method Details
.parse(str) ⇒ Object
40
41
42
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 40
def Address.parse( str )
Parser.parse :ADDRESS, str
end
|
Instance Method Details
#==(other) ⇒ Object
Also known as:
eql?
100
101
102
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 100
def ==( other )
other.respond_to? :spec and self.spec == other.spec
end
|
#accept(strategy, dummy1 = nil, dummy2 = nil) ⇒ Object
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 119
def accept( strategy, dummy1 = nil, dummy2 = nil )
unless @local
strategy.meta '<>' return
end
spec_p = (not @name and @routes.empty?)
if @name
strategy.phrase @name
strategy.space
end
tmp = spec_p ? '' : '<'
unless @routes.empty?
tmp << @routes.map {|i| '@' + i }.join(',') << ':'
end
tmp << self.spec
tmp << '>' unless spec_p
strategy.meta tmp
strategy.lwsp ''
end
|
#address_group? ⇒ Boolean
44
45
46
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 44
def address_group?
false
end
|
#domain ⇒ Object
82
83
84
85
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 82
def domain
return nil unless @domain
join_domain(@domain)
end
|
#dup ⇒ Object
110
111
112
113
114
115
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 110
def dup
obj = self.class.new(@local.dup, @domain.dup)
obj.name = @name.dup if @name
obj.routes.replace @routes
obj
end
|
#hash ⇒ Object
106
107
108
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 106
def hash
@local.hash ^ @domain.hash
end
|
#inspect ⇒ Object
72
73
74
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 72
def inspect
"#<#{self.class} #{address()}>"
end
|
#local ⇒ Object
76
77
78
79
80
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 76
def local
return nil unless @local
return '""' if @local.size == 1 and @local[0].empty?
@local.map {|i| quote_atom(i) }.join('.')
end
|
#spec ⇒ Object
Also known as:
address, addr
87
88
89
90
91
92
93
94
95
|
# File 'lib/action_mailer/vendor/tmail/address.rb', line 87
def spec
s = self.local
d = self.domain
if s and d
s + '@' + d
else
s
end
end
|
#spec=(str) ⇒ Object
Also known as:
addr=, address=
90
91
92
|
# File 'lib/action_mailer/vendor/tmail/obsolete.rb', line 90
def spec=( str )
@local, @domain = str.split(/@/,2).map {|s| s.split(/\./) }
end
|