Method: RMail::Address#initialize
- Defined in:
- lib/rmail/address.rb
#initialize(string = nil) ⇒ Address
Create a new address. If the string argument is not nil, it is parsed for mail addresses and if one is found, it is used to initialize this object.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/rmail/address.rb', line 52 def initialize(string = nil) @local = @domain = @comments = @display_name = nil if string.kind_of?(String) addrs = Address.parse(string) if addrs.length > 0 @local = addrs[0].local @domain = addrs[0].domain @comments = addrs[0].comments @display_name = addrs[0].display_name end else raise ArgumentError unless string.nil? end end |