scan() public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/erb.rb, line 522
        def scan
          stag_reg = /(.*?)(^[ \t]*<%-|<%-|#{stags.join('|')}|\z)/
          etag_reg = /(.*?)(-%>|#{etags.join('|')}|\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(/(\r?\n|\z)/)
            else
              yield(elem)
            end
          end
        end
Register or log in to add new notes.