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

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

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#add_expr_escaped(src, code) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/action_view/template/handlers/erb.rb', line 57

def add_expr_escaped(src, code)
  if code =~ BLOCK_EXPR
    src << "@output_buffer.safe_append= " << code
  else
    src << "@output_buffer.safe_concat((" << code << ").to_s);"
  end
end

#add_expr_literal(src, code) ⇒ Object



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

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

#add_postamble(src) ⇒ Object



65
66
67
# File 'lib/action_view/template/handlers/erb.rb', line 65

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

#add_preamble(src) ⇒ Object



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

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

#add_stmt(src, code) ⇒ Object



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

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

#add_text(src, text) ⇒ Object



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

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