Module: Erubis::PrintOutEnhancer

Included in:
PrintOutEruby, PrintOutSimplifiedEruby
Defined in:
lib/erubis/enhancer.rb

Overview

use print statement instead of ‘_buf << …’

this is only for Eruby.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.descObject

:nodoc:



87
88
89
# File 'lib/erubis/enhancer.rb', line 87

def self.desc   # :nodoc:
  "use print statement instead of '_buf << ...'"
end

Instance Method Details

#add_expr_escaped(src, code) ⇒ Object



102
103
104
# File 'lib/erubis/enhancer.rb', line 102

def add_expr_escaped(src, code)
  src << " print #{escaped_expr(code)};"
end

#add_expr_literal(src, code) ⇒ Object



98
99
100
# File 'lib/erubis/enhancer.rb', line 98

def add_expr_literal(src, code)
  src << " print((#{code}).to_s);"
end

#add_postamble(src) ⇒ Object



106
107
108
# File 'lib/erubis/enhancer.rb', line 106

def add_postamble(src)
  src << "\n" unless src[-1] == ?\n
end

#add_preamble(src) ⇒ Object



91
92
# File 'lib/erubis/enhancer.rb', line 91

def add_preamble(src)
end

#add_text(src, text) ⇒ Object



94
95
96
# File 'lib/erubis/enhancer.rb', line 94

def add_text(src, text)
  src << " print '#{escape_text(text)}';" unless text.empty?
end