Class TMail::HeaderField
In: actionmailer/lib/action_mailer/vendor/tmail/header.rb
Parent: Object

Methods

Included Modules

TextUtils StrategyInterface

Constants

FNAME_TO_CLASS = { 'date' => DateTimeHeader, 'resent-date' => DateTimeHeader, 'to' => AddressHeader, 'cc' => AddressHeader, 'bcc' => AddressHeader, 'from' => AddressHeader, 'reply-to' => AddressHeader, 'resent-to' => AddressHeader, 'resent-cc' => AddressHeader, 'resent-bcc' => AddressHeader, 'resent-from' => AddressHeader, 'resent-reply-to' => AddressHeader, 'sender' => SingleAddressHeader, 'resent-sender' => SingleAddressHeader, 'return-path' => ReturnPathHeader, 'message-id' => MessageIdHeader, 'resent-message-id' => MessageIdHeader, 'in-reply-to' => ReferencesHeader, 'received' => ReceivedHeader, 'references' => ReferencesHeader, 'keywords' => KeywordsHeader, 'encrypted' => EncryptedHeader, 'mime-version' => MimeVersionHeader, 'content-type' => ContentTypeHeader, 'content-transfer-encoding' => ContentTransferEncodingHeader, 'content-disposition' => ContentDispositionHeader, 'content-id' => MessageIdHeader, 'subject' => UnstructuredHeader, 'comments' => UnstructuredHeader, 'content-description' => UnstructuredHeader

External Aliases

new -> newobj

Public Class methods

[Source]

# File actionmailer/lib/action_mailer/vendor/tmail/header.rb, line 67
      def internal_new( name, conf )
        FNAME_TO_CLASS[name].newobj('', conf, true)
      end

[Source]

# File actionmailer/lib/action_mailer/vendor/tmail/header.rb, line 73
    def initialize( body, conf, intern = false )
      @body = body
      @config = conf

      @illegal = false
      @parsed = false
      if intern
        @parsed = true
        parse_init
      end
    end

[Source]

# File actionmailer/lib/action_mailer/vendor/tmail/header.rb, line 47
      def new( name, body, conf = DEFAULT_CONFIG )
        klass = FNAME_TO_CLASS[name.downcase] || UnstructuredHeader
        klass.newobj body, conf
      end

[Source]

# File actionmailer/lib/action_mailer/vendor/tmail/header.rb, line 52
      def new_from_port( port, name, conf = DEFAULT_CONFIG )
        re = Regep.new('\A(' + Regexp.quote(name) + '):', 'i')
        str = nil
        port.ropen {|f|
            f.each do |line|
              if m = re.match(line)            then str = m.post_match.strip
              elsif str and /\A[\t ]/ === line then str << ' ' << line.strip
              elsif /\A-*\s*\z/ === line       then break
              elsif str                        then break
              end
            end
        }
        new(name, str, Config.to_config(conf))
      end

Public Instance methods

[Source]

# File actionmailer/lib/action_mailer/vendor/tmail/header.rb, line 132
    def accept( strategy, dummy1 = nil, dummy2 = nil )
      ensure_parsed
      do_accept strategy
      strategy.terminate
    end

[Source]

# File actionmailer/lib/action_mailer/vendor/tmail/header.rb, line 117
    def body
      ensure_parsed
      v = Decoder.new(s = '')
      do_accept v
      v.terminate
      s
    end

[Source]

# File actionmailer/lib/action_mailer/vendor/tmail/header.rb, line 125
    def body=( str )
      @body = str
      clear_parse_status
    end

[Source]

# File actionmailer/lib/action_mailer/vendor/tmail/header.rb, line 93
    def empty?
      ensure_parsed
      return true if @illegal
      isempty?
    end

[Source]

# File actionmailer/lib/action_mailer/vendor/tmail/header.rb, line 89
    def illegal?
      @illegal
    end

[Source]

# File actionmailer/lib/action_mailer/vendor/tmail/header.rb, line 85
    def inspect
      "#<#{self.class} #{@body.inspect}>"
    end

Private Instance methods

defabstract parse end

[Source]

# File actionmailer/lib/action_mailer/vendor/tmail/header.rb, line 110
    def clear_parse_status
      @parsed = false
      @illegal = false
    end

[Source]

# File actionmailer/lib/action_mailer/vendor/tmail/header.rb, line 101
    def ensure_parsed
      return if @parsed
      @parsed = true
      parse
    end

[Validate]