Module: Padrino::Rendering::SafeBufferEnhancer

### Home Classes Methods

### In Files

- lib/padrino/rendering/erubis_template.rb

### Methods

- #add_expr_escaped
- #add_expr_literal
- #add_stmt
- #add_text

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Padrino
- Padrino::Helpers
- Padrino::Helpers::AssetTagHelpers
- Padrino::Helpers::FormBuilder
- Padrino::Helpers::FormBuilder::AbstractFormBuilder
- Padrino::Helpers::FormBuilder::DeprecatedBuilderMethods
- Padrino::Helpers::FormBuilder::StandardFormBuilder
- Padrino::Helpers::FormHelpers
- Padrino::Helpers::FormHelpers::Errors
- Padrino::Helpers::FormHelpers::Options
- Padrino::Helpers::FormHelpers::Security
- Padrino::Helpers::NumberHelpers
- Padrino::Helpers::OutputHelpers
- Padrino::Helpers::OutputHelpers::AbstractHandler
- Padrino::Helpers::OutputHelpers::ErbHandler
- Padrino::Helpers::OutputHelpers::HamlHandler
- Padrino::Helpers::OutputHelpers::SinatraCurrentEngine
- Padrino::Helpers::OutputHelpers::SlimHandler
- Padrino::Helpers::RenderHelpers
- Padrino::Helpers::TagHelpers
- Padrino::Helpers::TranslationHelpers
- Padrino::Rendering
- Padrino::Rendering::ClassMethods
- Padrino::Rendering::ErubisTemplate
- Padrino::Rendering::HamlTemplate
- Padrino::Rendering::InstanceMethods
- Padrino::Rendering::SafeBufferEnhancer
- Padrino::Rendering::SafeEruby
- Padrino::Rendering::SafeTemplate
- Padrino::Rendering::SlimTemplate
- Padrino::Rendering::TemplateNotFound
- Haml
- Haml::Helpers
- Haml::Util

No matching classes.

# Padrino::Rendering::SafeBufferEnhancer

SafeBufferEnhancer is an Erubis Enhancer that compiles templates that are fit for using ActiveSupport::SafeBuffer as a Buffer.

@api private

### Public Instance Methods

add_expr_escaped(src, code) click to toggle source

    # File lib/padrino/rendering/erubis_template.rb, line 19
    def add_expr_escaped(src, code)
      src << " #{@bufvar}.safe_concat " << code << ';'
    end

add_expr_literal(src, code) click to toggle source

    # File lib/padrino/rendering/erubis_template.rb, line 9
    def add_expr_literal(src, code)
      src << " #{@bufvar}.concat((" << code << ').to_s);'
    end

add_stmt(src, code) click to toggle source

    # File lib/padrino/rendering/erubis_template.rb, line 13
    def add_stmt(src, code)
      code = code.sub('end', 'nil;end') if code =~ /\A\s*end\s*\Z/
      src << code
      src << ';' unless code[-1] == \n\
    end

add_text(src, text) click to toggle source

    # File lib/padrino/rendering/erubis_template.rb, line 23
    def add_text(src, text)
      src << " #{@bufvar}.safe_concat '" << escape_text(text) << "';" unless text.empty?
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.