Sha256: 20e66593776f5c5acec5b49c2daecc003d48e15e9ce74e18886e08917bc741c7

Contents?: true

Size: 996 Bytes

Versions: 3

Compression:

Stored size: 996 Bytes

Contents

# encoding: utf-8
module Mail
  module CommonMessageId # :nodoc:
    
    module ClassMethods # :nodoc:
      
    end
    
    module InstanceMethods # :doc:
      
      def tree
        @tree ||= element.tree
      end
      
      def element
        @element ||= Mail::MessageIdsElement.new(value)
      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

3 entries across 3 versions & 1 rubygems

Version Path
mail-1.5.2 lib/mail/fields/common/common_message_id.rb
mail-1.5.1 lib/mail/fields/common/common_message_id.rb
mail-1.5.0 lib/mail/fields/common/common_message_id.rb