Class: ActionView::Template::Handlers::Erubis

Inherits:
Erubis::Eruby
  • Object
show all
Defined in:
actionpack/lib/action_view/template/handlers/erb.rb

Constant Summary

BLOCK_EXPR =
/\s+(do|\{)(\s*\|[^|]*\|)?\s*\Z/

Instance Method Summary (collapse)

Instance Method Details

- (Object) add_expr_escaped(src, code)



56
57
58
# File 'actionpack/lib/action_view/template/handlers/erb.rb', line 56

def add_expr_escaped(src, code)
  src << '@output_buffer.append= ' << escaped_expr(code) << ';'
end

- (Object) add_expr_literal(src, code)



40
41
42
43
44
45
46
# File 'actionpack/lib/action_view/template/handlers/erb.rb', line 40

def add_expr_literal(src, code)
  if code =~ BLOCK_EXPR
    src << '@output_buffer.append= ' << code
  else
    src << '@output_buffer.append= (' << code << ');'
  end
end

- (Object) add_postamble(src)



60
61
62
# File 'actionpack/lib/action_view/template/handlers/erb.rb', line 60

def add_postamble(src)
  src << '@output_buffer.to_s'
end

- (Object) add_preamble(src)



29
30
31
# File 'actionpack/lib/action_view/template/handlers/erb.rb', line 29

def add_preamble(src)
  src << "@output_buffer = ActionView::OutputBuffer.new;"
end

- (Object) add_stmt(src, code)



48
49
50
51
52
53
54
# File 'actionpack/lib/action_view/template/handlers/erb.rb', line 48

def add_stmt(src, code)
  if code =~ BLOCK_EXPR
    src << '@output_buffer.append_if_string= ' << code
  else
    super
  end
end

- (Object) add_text(src, text)



33
34
35
36
# File 'actionpack/lib/action_view/template/handlers/erb.rb', line 33

def add_text(src, text)
  return if text.empty?
  src << "@output_buffer.safe_concat('" << escape_text(text) << "');"
end