Class: TMail::TMailScanner

Inherits:
Object show all
Defined in:
lib/tmail/scanner_r.rb,
ext/tmailscanner/tmail/tmailscanner.c

Constant Summary collapse

Version =
tmp
MIME_HEADERS =
{
  :CTYPE        => true,
  :CENCODING    => true,
  :CDISPOSITION => true
}
PATTERN_TABLE =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, scantype, comments) ⇒ TMailScanner

Returns a new instance of TMailScanner.


98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/tmail/scanner_r.rb', line 98

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[TMail.KCODE]
  @word_re = (MIME_HEADERS[scantype] ? token : atom)
end

Instance Attribute Details

#debugObject

TODO: Documentation needed


125
126
127
# File 'ext/tmailscanner/tmail/tmailscanner.c', line 125

def debug
  @debug
end

Class Method Details

.newObject

Creates a new mail


83
84
85
# File 'ext/tmailscanner/tmail/tmailscanner.c', line 83

static VALUE
mails_s_new(klass, str, ident, cmt)
VALUE klass, str, ident, cmt;

Instance Method Details

#scan(&block) ⇒ Object

TODO: Documentation needed


476
477
478
479
480
481
482
483
484
485
486
487
488
489
# File 'ext/tmailscanner/tmail/tmailscanner.c', line 476

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