Sha256: b9b2764dfcc1fbd9c159b42d8ce8e9bc57e363ed0f625158f56340afe55c0d42

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

# encoding: utf-8
module Mail
  module CommonMessageId # :nodoc:
    
    module ClassMethods # :nodoc:
      
    end
    
    module InstanceMethods # :doc:

      def element
        @element ||= Mail::MessageIdsElement.new(value)
      end
      
      def parse(val = value)
        unless val.blank?
          @element = Mail::MessageIdsElement.new(val)
        else
          nil
        end
      end
      
      def message_id
        element.message_id
      end
      
      def message_ids
        element.message_ids
      end
      
      def default
        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
    
    def self.included(receiver) # :nodoc:
      receiver.extend         ClassMethods
      receiver.send :include, InstanceMethods
    end
    
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
mail-2.1.5 lib/mail/fields/common/common_message_id.rb
mail-2.1.3 lib/mail/fields/common/common_message_id.rb
kbaum-mail-2.1.2.1 lib/mail/fields/common/common_message_id.rb
mail-2.1.2 lib/mail/fields/common/common_message_id.rb
mail-2.1.1 lib/mail/fields/common/common_message_id.rb
mail-2.1.0 lib/mail/fields/common/common_message_id.rb
mail-2.0.5 lib/mail/fields/common/common_message_id.rb
mail-2.0.3 lib/mail/fields/common/common_message_id.rb
mail-1.6.0 lib/mail/fields/common/common_message_id.rb
mail-1.5.4 lib/mail/fields/common/common_message_id.rb
mail-1.5.3 lib/mail/fields/common/common_message_id.rb