Sha256: 184b9e2bbd512d64b1e7ce13910a07f33d251abbd1c4516f088221fb47379099

Contents?: true

Size: 398 Bytes

Versions: 1

Compression:

Stored size: 398 Bytes

Contents

module Vmail
  module AddressQuoter

    def quote_addresses(string)
      email_addrs = []
      string.scan(/\s*(.*?)\s*<(.+?)>(?:,|\Z)/) do |match|
        # yields ["Bob Smith", "bobsmith@gmail.com"]
        # then   ["Jones, Rich A.", "richjones@gmail.com"]
        email_addrs << "\"#{match.first}\" <#{match.last}>"
      end
      res = email_addrs.join(", ") 
      res
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vmail-1.3.2 lib/vmail/address_quoter.rb