Module | Erubis::PerlGenerator
In: | erubis/engine/eperl.rb

### Methods

add_expr_debug add_expr_escaped add_expr_literal add_postamble add_preamble add_stmt add_text escape_text init_generator

### Included Modules

Generator

### Public Instance methods

add_expr_debug(src, code)

[Source]

    # File erubis/engine/eperl.rb, line 50
        def add_expr_debug(src, code)
          code.strip!
          s = code.gsub(/\'/, "\\'")
          src << @func << "('*** debug: #{code}=', #{code}, \"\\n\");"
        end

add_expr_escaped(src, code)

[Source]

    # File erubis/engine/eperl.rb, line 46
        def add_expr_escaped(src, code)
          add_expr_literal(src, escaped_expr(code))
        end

add_expr_literal(src, code)

[Source]

    # File erubis/engine/eperl.rb, line 41
        def add_expr_literal(src, code)
          code.strip!
          src << @func << "(" << code << "); "
        end

add_postamble(src)

[Source]

    # File erubis/engine/eperl.rb, line 60
        def add_postamble(src)
          src << "\n" unless src[-1] == ?\n
        end

add_preamble(src)

[Source]

    # File erubis/engine/eperl.rb, line 29
        def add_preamble(src)
          src << "use HTML::Entities; ";
        end

add_stmt(src, code)

[Source]

    # File erubis/engine/eperl.rb, line 56
        def add_stmt(src, code)
          src << code
        end

add_text(src, text)

[Source]

    # File erubis/engine/eperl.rb, line 37
        def add_text(src, text)
          src << @func << "('" << escape_text(text) << "'); " unless text.empty?
        end

escape_text(text)

[Source]

    # File erubis/engine/eperl.rb, line 33
        def escape_text(text)
          return text.gsub!(/['\\]/, '\\\\\&') || text
        end

init_generator(properties={})

[Source]

    # File erubis/engine/eperl.rb, line 23
        def init_generator(properties={})
          super
          @escapefunc ||= 'encode_entities'
          @func = properties[:func] || 'print'
        end

[Validate]