Class: Twig::OutputBuffer
- Inherits:
-
Object
- Object
- Twig::OutputBuffer
- Defined in:
- lib/twig/output_buffer.rb
Instance Method Summary collapse
- #append=(string) ⇒ Object
-
#initialize ⇒ OutputBuffer
constructor
A new instance of OutputBuffer.
- #safe_append=(string) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ OutputBuffer
Returns a new instance of OutputBuffer.
5 6 7 |
# File 'lib/twig/output_buffer.rb', line 5 def initialize @buffer = +'' end |
Instance Method Details
#append=(string) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/twig/output_buffer.rb', line 9 def append=(string) unless string.nil? string = string.to_s @buffer << if string.html_safe? string else CGI.escapeHTML(string) end end end |
#safe_append=(string) ⇒ Object
21 22 23 |
# File 'lib/twig/output_buffer.rb', line 21 def safe_append=(string) @buffer << string.html_safe end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/twig/output_buffer.rb', line 25 def to_s @buffer end |