class Hermes::AddrList
Public Class Methods
new(*addrs)
click to toggle source
# File lib/hermes/addrs.rb, line 583 def initialize *addrs @list = [] push addrs end
Public Instance Methods
==(str)
click to toggle source
# File lib/hermes/addrs.rb, line 657 def == str @list.find { |a| a == str } end
add(mail, real = nil)
click to toggle source
# File lib/hermes/addrs.rb, line 661 def add mail, real = nil if real or not Addr === mail then mail = Addr.create mail, real end @list.push mail self end
add_encoded(cont)
click to toggle source
# File lib/hermes/addrs.rb, line 676 def add_encoded cont Addr.parse_decode cont.to_s do |a,| @list.push a end self end
add_quoted(str)
click to toggle source
# File lib/hermes/addrs.rb, line 669 def add_quoted str Addr.parse str.to_s do |a,| @list.push a end self end
each { |addr| ... } → self
click to toggle source
Call block for each address.
# File lib/hermes/addrs.rb, line 625 def each @list.each { |a| yield a } end
encode()
click to toggle source
# File lib/hermes/addrs.rb, line 611 def encode r = [] @list.map { |a| if r.last then r.last << "," end r.push a.encode.dup } r end
has?(*mails) { |*$~.captures| ... }
click to toggle source
# File lib/hermes/addrs.rb, line 630 def has? *mails mails.find { |m| case m when Regexp then @list.find { |a| if a.plain =~ m then yield *$~.captures if block_given? true end } else self == m end } end
Also aliased as: has
inspect()
click to toggle source
# File lib/hermes/addrs.rb, line 599 def inspect "<#{self.class}: " + (@list.map { |a| a.inspect }.join ", ") + ">" end
parse(cont)
click to toggle source
# File lib/hermes/addrs.rb, line 576 def parse cont new.add_encoded cont end
push(addrs)
click to toggle source
# File lib/hermes/addrs.rb, line 590 def push addrs case addrs when nil then when String then add_encoded addrs when Addr then @list.push addrs else addrs.each { |a| push a } end end
quote()
click to toggle source
# File lib/hermes/addrs.rb, line 607 def quote @list.map { |a| a.quote }.join ", " end
to_s()
click to toggle source
# File lib/hermes/addrs.rb, line 603 def to_s @list.map { |a| a.to_s }.join ", " end
under_domain(*args) { |l| ... }
click to toggle source
# File lib/hermes/addrs.rb, line 647 def under_domain *args @list.each { |a| a.plain =~ /(.*)@/ or next l, d = $1, $' case d when *args then yield l end } end