Sha256: 51bcc02e03203eb99991a0801f37d513462a20552915a53e2394fac76f04b8f2

Contents?: true

Size: 975 Bytes

Versions: 5

Compression:

Stored size: 975 Bytes

Contents

# encoding: utf-8
module Mail
  module CommonField # :nodoc:
    
    module ClassMethods # :nodoc:
      
    end
    
    module InstanceMethods # :doc:
      
      def name=(value)
        @name = value
      end
      
      def name
        @name
      end
      
      def value=(value)
        @length = nil
        @tree = nil
        @element = nil
        @value = value
      end
      
      def value
        @value
      end
      
      def to_s
        decoded
      end
      
      def field_length
        @length ||= name.length + value.length + ': '.length
      end
      
      def responsible_for?( val )
        name.to_s.downcase == val.to_s.downcase
      end

      private

      def strip_field(field_name, string) 
        string.to_s.gsub(/#{field_name}:\s+/i, '')
      end

    end
    
    def self.included(receiver) # :nodoc:
      receiver.extend         ClassMethods
      receiver.send :include, InstanceMethods
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mail-1.4.3 lib/mail/fields/common/common_field.rb
mail-1.4.2 lib/mail/fields/common/common_field.rb
mail-1.4.1 lib/mail/fields/common/common_field.rb
mail-1.4.0 lib/mail/fields/common/common_field.rb
mail-1.3.5 lib/mail/fields/common/common_field.rb