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 49
        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 45
        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 40
        def add_expr_literal(src, code)
          code.strip!
          src << @func << "(" << code << "); "
        end

add_postamble(src)

[Source]

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

add_preamble(src)

[Source]

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

add_stmt(src, code)

[Source]

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

add_text(src, text)

[Source]

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

escape_text(text)

[Source]

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

init_generator(properties={})

[Source]

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

[Validate]