Class TMail::Scanner_R
In: lib/tmail/scanner_r.rb
Parent: Object

Methods

new   scan  

Constants

Version = '0.10.8'
MIME_HEADERS = { :CTYPE => true, :CENCODING => true, :CDISPOSITION => true
PATTERN_TABLE = {}
RECV_TOKEN = { 'from' => :FROM, 'by' => :BY, 'via' => :VIA, 'with' => :WITH, 'id' => :ID, 'for' => :FOR

Attributes

debug  [RW] 

Public Class methods

[Source]

# File lib/tmail/scanner_r.rb, line 81
    def initialize(str, scantype, comments)
      init_scanner str
      @comments = comments || []
      @debug    = false

      # fix scanner mode
      @received  = (scantype == :RECEIVED)
      @is_mime_header = MIME_HEADERS[scantype]

      atom, token, @quoted_re, @domlit_re, @comment_re = PATTERN_TABLE[$KCODE]
      @word_re = (MIME_HEADERS[scantype] ? token : atom)
    end

Public Instance methods

[Source]

# File lib/tmail/scanner_r.rb, line 96
    def scan(&block)
      if @debug
        scan_main do |arr|
          s, v = arr
          printf "%7d %-10s %s\n",
                 rest_size(),
                 s.respond_to?(:id2name) ? s.id2name : s.inspect,
                 v.inspect
          yield arr
        end
      else
        scan_main(&block)
      end
    end

[Validate]