Sha256: 226393bdb2f3ac64486560d7ed0892a1ce2a0dfd1c34c31e7b8cb06e67fbe5f5

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

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

8 entries across 8 versions & 1 rubygems

Version Path
mail-2.0.5 lib/mail/fields/common/common_field.rb
mail-2.0.3 lib/mail/fields/common/common_field.rb
mail-1.6.0 lib/mail/fields/common/common_field.rb
mail-1.5.4 lib/mail/fields/common/common_field.rb
mail-1.5.3 lib/mail/fields/common/common_field.rb
mail-1.5.2 lib/mail/fields/common/common_field.rb
mail-1.5.1 lib/mail/fields/common/common_field.rb
mail-1.5.0 lib/mail/fields/common/common_field.rb