Class: Flay::Erubis

Inherits:
Erubis::Eruby
  • Object
show all
Defined in:
lib/flay_erb.rb

Overview

:nodoc:

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#add_expr_escaped(src, code) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/flay_erb.rb', line 36

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

#add_expr_literal(src, code) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/flay_erb.rb', line 28

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