Module: Erubis::PhpGenerator
Instance Attribute Summary
Attributes included from Generator
Class Method Summary collapse
-
.supported_properties ⇒ Object
:nodoc:.
Instance Method Summary collapse
- #add_expr_debug(src, code) ⇒ Object
- #add_expr_escaped(src, code) ⇒ Object
- #add_expr_literal(src, code) ⇒ Object
- #add_postamble(src) ⇒ Object
- #add_preamble(src) ⇒ Object
- #add_stmt(src, code) ⇒ Object
- #add_text(src, text) ⇒ Object
- #escape_text(text) ⇒ Object
- #init_generator(properties = {}) ⇒ Object
Methods included from Generator
Class Method Details
.supported_properties ⇒ Object
:nodoc:
16 17 18 |
# File 'lib/erubis/engine/ephp.rb', line 16 def self.supported_properties() # :nodoc: return [] end |
Instance Method Details
#add_expr_debug(src, code) ⇒ Object
46 47 48 49 50 |
# File 'lib/erubis/engine/ephp.rb', line 46 def add_expr_debug(src, code) code.strip! s = code.gsub(/\'/, "\\'") src << "<?php error_log('*** debug: #{s}='.(#{code}), 0); ?>" end |
#add_expr_escaped(src, code) ⇒ Object
42 43 44 |
# File 'lib/erubis/engine/ephp.rb', line 42 def add_expr_escaped(src, code) add_expr_literal(src, escaped_expr(code)) end |
#add_expr_literal(src, code) ⇒ Object
37 38 39 40 |
# File 'lib/erubis/engine/ephp.rb', line 37 def add_expr_literal(src, code) code.strip! src << "<?php echo #{code}; ?>" end |
#add_postamble(src) ⇒ Object
63 64 65 |
# File 'lib/erubis/engine/ephp.rb', line 63 def add_postamble(src) # empty end |
#add_preamble(src) ⇒ Object
25 26 27 |
# File 'lib/erubis/engine/ephp.rb', line 25 def add_preamble(src) # empty end |
#add_stmt(src, code) ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/erubis/engine/ephp.rb', line 52 def add_stmt(src, code) src << "<?php" src << " " if code[0] != ?\ # if code[-1] == ?\n code.chomp! src << code << "?>\n" else src << code << "?>" end end |
#add_text(src, text) ⇒ Object
33 34 35 |
# File 'lib/erubis/engine/ephp.rb', line 33 def add_text(src, text) src << escape_text(text) end |
#escape_text(text) ⇒ Object
29 30 31 |
# File 'lib/erubis/engine/ephp.rb', line 29 def escape_text(text) return text.gsub!(/<\?xml\b/, '<<?php ?>?xml') || text end |
#init_generator(properties = {}) ⇒ Object
20 21 22 23 |
# File 'lib/erubis/engine/ephp.rb', line 20 def init_generator(properties={}) super @escapefunc ||= 'htmlspecialchars' end |