Method: RMail::Address#<=>
- Defined in:
- lib/rmail/address.rb
#<=>(other) ⇒ Object
Compare this address with another based on the email address portion only (any display name and comments are ignored). If the other object is not an RMail::Address, it is coerced into a string with its to_str method and then parsed into an RMail::Address object.
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/rmail/address.rb', line 73 def <=>(other) if !other.kind_of?(RMail::Address) other = RMail::Address.new(other.to_str) end cmp = (@local || '') <=> (other.local || '') if cmp == 0 cmp = (@domain || '') <=> (other.domain || '') end return cmp end |