Sha256: cd6909b044371299011647aa4c959438ddf6355f2264843027a540cc2d9fbb5a

Contents?: true

Size: 806 Bytes

Versions: 11

Compression:

Stored size: 806 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}: #{do_decode}\r\n}
    end
    
    def do_decode
      "#{message_ids.map { |m| "<#{m}>" }.join(' ')}"
    end
    
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
mail-2.2.16 lib/mail/fields/common/common_message_id.rb
mail-2.2.15 lib/mail/fields/common/common_message_id.rb
mail-2.2.14 lib/mail/fields/common/common_message_id.rb
mail-2.2.13 lib/mail/fields/common/common_message_id.rb
mail-2.2.12 lib/mail/fields/common/common_message_id.rb
mail-2.2.11 lib/mail/fields/common/common_message_id.rb
dball-mail-2.2.9.7 lib/mail/fields/common/common_message_id.rb
dball-mail-2.2.9.6 lib/mail/fields/common/common_message_id.rb
mail-2.2.10 lib/mail/fields/common/common_message_id.rb
dball-mail-2.2.9.2 lib/mail/fields/common/common_message_id.rb
dball-mail-2.2.9.1 lib/mail/fields/common/common_message_id.rb