### Home Classes Methods

### In Files

- lib/vmail/address_quoter.rb

### Methods

- #quote_addresses

### Class/Module Index

Quicksearch

- Vmail
- Vmail::AddressQuoter
- Vmail::ContactsExtractor
- Vmail::ImapClient
- Vmail::MessageFormatter
- Vmail::Options
- Vmail::Query
- Vmail::ReplyTemplate
- Vmail::SendOptions
- Vmail::Sender
- String

No matching classes.

# Vmail::AddressQuoter

### Public Instance Methods

quote_addresses(input) click to toggle source

    # File lib/vmail/address_quoter.rb, line 4
    def quote_addresses(input)
      parts = input.split /\s*,\s*/

      addrs = []
      savebin = ""

      #Group the parts together
      parts.each do |part|
        if part.include? "@"
          addrs << savebin + part
          savebin = ""
        else
          savebin = part + ", "
        end
      end

      #Quote the names
      addrs.map { |addr|
        # a little hackish
        if addr =~ /"/
          addr
        else
          addr.gsub(/^(.*) (<.*)/, '"\1" \2')
        end
      }.join(', ')
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.