158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
# File 'lib/howlr/message.rb', line 158
def self.parse(raw)
return nil if raw.nil?
raw =~ /^(?:(\w*):)?(.*)/
if $~[1]
protocol = $~[1].intern
address = $~[2]
elsif $~
protocol = :mailto
address = raw
else
raise ArgumentError, "#{raw.inspect} is not a valid address."
end
$LOG.debug "Parsing raw recipient: #{raw.inspect} --> protocol: #{protocol.inspect}, address: #{address.inspect}"
case protocol
when :mailto
deliverer = Howlr::Deliverers::Email
else
raise ArgumentError, "#{protocol.inspect} is not a valid delivery protocol!"
end
return Recipient.new(deliverer, address)
end
|