Sha256: f2cea2721a168840929dfe4cb5abcde440990a34d0f9831fcce5e8a44dd6f704

Contents?: true

Size: 770 Bytes

Versions: 3

Compression:

Stored size: 770 Bytes

Contents

# encoding: utf-8
module Mail
  module CommonField # :nodoc:
    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)
      if string.is_a?(Array)
        string.join(', ')
      else
        string.to_s.gsub(/#{field_name}:\s+/i, '')
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mail-2.1.5.3 lib/mail/fields/common/common_field.rb
mail-2.1.5.2 lib/mail/fields/common/common_field.rb
mail-2.1.5.1 lib/mail/fields/common/common_field.rb