Sha256: 58c121f484d0047966ade44a89484b947dbc678a5ea6d60ad989a96b2d8b5bc8

Contents?: true

Size: 975 Bytes

Versions: 10

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
        encoded
      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

10 entries across 10 versions & 1 rubygems

Version Path
mail-1.3.4 lib/mail/fields/common/common_field.rb
mail-1.3.3 lib/mail/fields/common/common_field.rb
mail-1.3.2 lib/mail/fields/common/common_field.rb
mail-1.3.1 lib/mail/fields/common/common_field.rb
mail-1.3.0 lib/mail/fields/common/common_field.rb
mail-1.2.9 lib/mail/fields/common/common_field.rb
mail-1.2.8 lib/mail/fields/common/common_field.rb
mail-1.2.6 lib/mail/fields/common/common_field.rb
mail-1.2.5 ./lib/mail/fields/common/common_field.rb
mail-1.2.1 ./lib/mail/fields/common/common_field.rb