Class: Yalphabetize::ErbCompiler::Scanner
- Inherits:
-
Object
- Object
- Yalphabetize::ErbCompiler::Scanner
- Defined in:
- lib/yalphabetize/erb_compiler.rb
Constant Summary collapse
- STAG_REG =
/(.*?)(#{DEFAULT_STAGS.join('|')}|\z)/m.freeze
- ETAG_REG =
/(.*?)(#{DEFAULT_ETAGS.join('|')}|\z)/m.freeze
Instance Attribute Summary collapse
-
#stag ⇒ Object
Returns the value of attribute stag.
Instance Method Summary collapse
-
#initialize(src) ⇒ Scanner
constructor
A new instance of Scanner.
- #scan ⇒ Object
Constructor Details
#initialize(src) ⇒ Scanner
Returns a new instance of Scanner.
14 15 16 17 |
# File 'lib/yalphabetize/erb_compiler.rb', line 14 def initialize(src) @src = src @stag = nil end |
Instance Attribute Details
#stag ⇒ Object
Returns the value of attribute stag.
27 28 29 |
# File 'lib/yalphabetize/erb_compiler.rb', line 27 def stag @stag end |
Instance Method Details
#scan ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/yalphabetize/erb_compiler.rb', line 19 def scan until scanner.eos? scanner.scan(stag ? ETAG_REG : STAG_REG) yield(scanner[1]) yield(scanner[2]) end end |