Class: TMail::TMailScanner

Inherits:
Object show all
Defined in:
lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner_r.rb

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, scantype, comments) ⇒ TMailScanner

Returns a new instance of TMailScanner.



99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner_r.rb', line 99

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

Returns the value of attribute debug.



112
113
114
# File 'lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner_r.rb', line 112

def debug
  @debug
end

Instance Method Details

#scan(&block) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner_r.rb', line 114

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