Class TMail::AddressGroup
In: lib/tmail/address.rb
Parent: Object

Methods

==   []   accept   add   address_group?   delete   each   each_address   empty?   eql?   flatten   hash   include?   new   push   size   to_a   to_ary  

Included Modules

Enumerable StrategyInterface

Attributes

name  [R] 

Public Class methods

[Source]

# File lib/tmail/address.rb, line 335
    def initialize( name, addrs )
      @name = name
      @addresses = addrs
    end

Public Instance methods

[Source]

# File lib/tmail/address.rb, line 342
    def ==( other )
      other.respond_to? :to_a and @addresses == other.to_a
    end

[Source]

# File lib/tmail/address.rb, line 352
    def []( idx )
      @addresses[idx]
    end

[Source]

# File lib/tmail/address.rb, line 406
    def accept( strategy, dummy1 = nil, dummy2 = nil )
      strategy.phrase @name
      strategy.meta ':'
      strategy.space
      first = true
      each do |mbox|
        if first
          first = false
        else
          strategy.meta ','
        end
        strategy.space
        mbox.accept strategy
      end
      strategy.meta ';'
      strategy.lwsp ''
    end

[Source]

# File lib/tmail/address.rb, line 394
    def add( a )
      @addresses.push a
    end

[Source]

# File lib/tmail/address.rb, line 331
    def address_group?
      true
    end

[Source]

# File lib/tmail/address.rb, line 400
    def delete( a )
      @addresses.delete a
    end

[Source]

# File lib/tmail/address.rb, line 364
    def each( &block )
      @addresses.each(&block)
    end

[Source]

# File lib/tmail/address.rb, line 390
    def each_address( &block )
      flatten.each(&block)
    end

[Source]

# File lib/tmail/address.rb, line 360
    def empty?
      @addresses.empty?
    end
eql?( other )

Alias for #==

[Source]

# File lib/tmail/address.rb, line 378
    def flatten
      set = []
      @addresses.each do |a|
        if a.respond_to? :flatten
          set.concat a.flatten
        else
          set.push a
        end
      end
      set
    end

[Source]

# File lib/tmail/address.rb, line 348
    def hash
      map {|i| i.hash }.hash
    end

[Source]

# File lib/tmail/address.rb, line 374
    def include?( a )
      @addresses.include? a
    end
push( a )

Alias for add

[Source]

# File lib/tmail/address.rb, line 356
    def size
      @addresses.size
    end

[Source]

# File lib/tmail/address.rb, line 368
    def to_a
      @addresses.dup
    end
to_ary()

Alias for to_a

[Validate]