Class: ERB::Compiler::Scanner

Inherits:
Object
  • Object
show all
Defined in:
lib/erb.rb

Overview

:nodoc:

Direct Known Subclasses

TrimScanner

Constant Summary collapse

DEFAULT_STAGS =
%w(<%% <%= <%# <%).freeze
DEFAULT_ETAGS =
%w(%%> %>).freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(src, trim_mode, percent) ⇒ Scanner

Returns a new instance of Scanner.


369
370
371
372
373
374
# File 'lib/erb.rb', line 369

def initialize(src, trim_mode, percent)
  @src = src
  @stag = nil
  @stags = DEFAULT_STAGS
  @etags = DEFAULT_ETAGS
end

Instance Attribute Details

#etagsObject (readonly)

Returns the value of attribute etags


376
377
378
# File 'lib/erb.rb', line 376

def etags
  @etags
end

#stagObject

Returns the value of attribute stag


375
376
377
# File 'lib/erb.rb', line 375

def stag
  @stag
end

#stagsObject (readonly)

Returns the value of attribute stags


376
377
378
# File 'lib/erb.rb', line 376

def stags
  @stags
end

Class Method Details

.default_scanner=(klass) ⇒ Object


358
359
360
# File 'lib/erb.rb', line 358

def self.default_scanner=(klass)
  @default_scanner = klass
end

.make_scanner(src, trim_mode, percent) ⇒ Object


362
363
364
365
# File 'lib/erb.rb', line 362

def self.make_scanner(src, trim_mode, percent)
  klass = @scanner_map.fetch([trim_mode, percent], @default_scanner)
  klass.new(src, trim_mode, percent)
end

.register_scanner(klass, trim_mode, percent) ⇒ Object Also known as: regist_scanner


352
353
354
# File 'lib/erb.rb', line 352

def register_scanner(klass, trim_mode, percent)
  @scanner_map[[trim_mode, percent]] = klass
end

Instance Method Details

#scanObject


378
# File 'lib/erb.rb', line 378

def scan; end