Sha256: 5bb750804a0f4f6913931b817b20b1264a32494aa333f6cc79a4580e0f52c39a

Contents?: true

Size: 801 Bytes

Versions: 13

Compression:

Stored size: 801 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true
require 'mail/fields/named_structured_field'
require 'mail/utilities'

module Mail
  class CommonMessageIdField < NamedStructuredField #:nodoc:
    def element
      @element ||= Mail::MessageIdsElement.new(value)
    end

    def message_id
      element.message_id
    end

    def message_ids
      element.message_ids
    end

    def default
      ids = message_ids
      ids.one? ? ids.first : ids
    end

    def to_s
      decoded.to_s
    end

    private
      def do_encode
        %Q{#{name}: #{formatted_message_ids("\r\n ")}\r\n}
      end

      def do_decode
        formatted_message_ids
      end

      def formatted_message_ids(join = ' ')
        message_ids.map { |m| "<#{m}>" }.join(join) if message_ids.any?
      end
  end
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/fields/common_message_id_field.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/fields/common_message_id_field.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/fields/common_message_id_field.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/fields/common_message_id_field.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/fields/common_message_id_field.rb
mail-2.8.1 lib/mail/fields/common_message_id_field.rb
mail-2.8.1.rc2 lib/mail/fields/common_message_id_field.rb
mail-2.8.0.1 lib/mail/fields/common_message_id_field.rb
mail-2.8.0.1.rc1 lib/mail/fields/common_message_id_field.rb
mail-2.8.0 lib/mail/fields/common_message_id_field.rb
mail-2.8.0.rc3 lib/mail/fields/common_message_id_field.rb
mail-2.8.0.rc2 lib/mail/fields/common_message_id_field.rb
mail-2.8.0.rc1 lib/mail/fields/common_message_id_field.rb