Class: ERB::Compiler::Scanner
- Inherits:
-
Object
- Object
- ERB::Compiler::Scanner
- Defined in:
- lib/erb/compiler.rb
Overview
:nodoc:
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_STAGS =
%w(<%% <%= <%# <%).freeze
- DEFAULT_ETAGS =
%w(%%> %>).freeze
Instance Attribute Summary collapse
-
#etags ⇒ Object
readonly
Returns the value of attribute etags.
-
#stag ⇒ Object
Returns the value of attribute stag.
-
#stags ⇒ Object
readonly
Returns the value of attribute stags.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(src, trim_mode, percent) ⇒ Scanner
constructor
A new instance of Scanner.
- #register_scanner(klass, trim_mode, percent) ⇒ Object
- #scan ⇒ Object
Constructor Details
#initialize(src, trim_mode, percent) ⇒ Scanner
Returns a new instance of Scanner.
108 109 110 111 112 113 |
# File 'lib/erb/compiler.rb', line 108 def initialize(src, trim_mode, percent) @src = src @stag = nil @stags = DEFAULT_STAGS @etags = DEFAULT_ETAGS end |
Instance Attribute Details
#etags ⇒ Object (readonly)
Returns the value of attribute etags.
115 116 117 |
# File 'lib/erb/compiler.rb', line 115 def @etags end |
#stag ⇒ Object
Returns the value of attribute stag.
114 115 116 |
# File 'lib/erb/compiler.rb', line 114 def stag @stag end |
#stags ⇒ Object (readonly)
Returns the value of attribute stags.
115 116 117 |
# File 'lib/erb/compiler.rb', line 115 def @stags end |
Class Method Details
.default_scanner=(klass) ⇒ Object
97 98 99 |
# File 'lib/erb/compiler.rb', line 97 def self.default_scanner=(klass) @default_scanner = klass end |
.make_scanner(src, trim_mode, percent) ⇒ Object
101 102 103 104 |
# File 'lib/erb/compiler.rb', line 101 def self.make_scanner(src, trim_mode, percent) klass = @scanner_map.fetch([trim_mode, percent], @default_scanner) klass.new(src, trim_mode, percent) end |
Instance Method Details
#register_scanner(klass, trim_mode, percent) ⇒ Object
86 87 88 |
# File 'lib/erb/compiler.rb', line 86 def register_scanner(klass, trim_mode, percent) @scanner_map = Ractor.make_shareable({ **@scanner_map, [trim_mode, percent] => klass }) end |
#scan ⇒ Object
117 |
# File 'lib/erb/compiler.rb', line 117 def scan; end |