Sha256: f2bfd8b9c55dd43771fbd98353a50654ba4fb65dd9ac710e1d2bfe4c525271c4

Contents?: true

Size: 841 Bytes

Versions: 7

Compression:

Stored size: 841 Bytes

Contents

# encoding: utf-8
module Mail
  module CommonMessageId # :nodoc:
    def element
      @element ||= Mail::MessageIdsElement.new(value) unless value.blank?
    end

    def parse(val = value)
      unless val.blank?
        @element = Mail::MessageIdsElement.new(val)
      else
        nil
      end
    end
    
    def message_id
      element.message_id if element
    end
    
    def message_ids
      element.message_ids if element
    end
    
    def default
      return nil unless message_ids
      if message_ids.length == 1
        message_ids[0]
      else
        message_ids
      end
    end

    private
    
    def do_encode(field_name)
      %Q{#{field_name}: #{message_ids.map { |m| "<#{m}>" }.join(', ')}\r\n}
    end
    
    def do_decode
      "#{message_ids.map { |m| "<#{m}>" }.join(', ')}"
    end
    
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
dball-mail-2.2.9.4 lib/mail/fields/common/common_message_id.rb
dball-mail-2.2.9.3 lib/mail/fields/common/common_message_id.rb
mail-2.2.9.1 lib/mail/fields/common/common_message_id.rb
mail-2.2.9 lib/mail/fields/common/common_message_id.rb
mail-2.2.7 lib/mail/fields/common/common_message_id.rb
mail-2.2.6.1 lib/mail/fields/common/common_message_id.rb
mail-2.2.6 lib/mail/fields/common/common_message_id.rb