Class: ERB::Compiler::Scanner

Inherits:
Object
  • Object
show all
Defined in:
lib/erb/compiler.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.



102
103
104
105
106
107
# File 'lib/erb/compiler.rb', line 102

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.



109
110
111
# File 'lib/erb/compiler.rb', line 109

def etags
  @etags
end

#stagObject

Returns the value of attribute stag.



108
109
110
# File 'lib/erb/compiler.rb', line 108

def stag
  @stag
end

#stagsObject (readonly)

Returns the value of attribute stags.



109
110
111
# File 'lib/erb/compiler.rb', line 109

def stags
  @stags
end

Class Method Details

.default_scanner=(klass) ⇒ Object



91
92
93
# File 'lib/erb/compiler.rb', line 91

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

.make_scanner(src, trim_mode, percent) ⇒ Object



95
96
97
98
# File 'lib/erb/compiler.rb', line 95

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



85
86
87
# File 'lib/erb/compiler.rb', line 85

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

Instance Method Details

#scanObject



111
# File 'lib/erb/compiler.rb', line 111

def scan; end