method
scan
scan()
public
Hide source
# File lib/erb.rb, line 448 def scan stag_reg = /(.*?)(^[ \t]*<%-|<%%|<%=|<%#|<%-|<%|\z)/ etag_reg = /(.*?)(%%>|-%>|%>|\z)/ scanner = StringScanner.new(@src) while ! scanner.eos? scanner.scan(@stag ? etag_reg : stag_reg) yield(scanner[1]) elem = scanner[2] if /[ \t]*<%-/ =~ elem yield('<%') elsif elem == '-%>' yield('%>') yield(:cr) if scanner.scan(/(\n|\z)/) else yield(elem) end end end