Class: ORB::OutputBuffer

Inherits:
Temple::Generators::RailsOutputBuffer
  • Object
show all
Defined in:
lib/orb/rails_template.rb

Overview

Generator that fixes void-context warnings from Temple’s AttributeRemover.

AttributeRemover wraps dynamic attributes (e.g. class=expr) in a

:capture, tmp, …

+ [:if, “!tmp.empty?”, …] pair. The default

RailsOutputBuffer uses itself as the capture generator, and its return_buffer (inherited from StringBuffer) emits the bare variable name as the last expression. Inside the surrounding :multi this becomes a statement in void context since Ruby -w warns about it.

This subclass returns nil from return_buffer when acting as a capture generator (buffer != @output_buffer), suppressing the bare variable.

Instance Method Summary collapse

Instance Method Details

#return_bufferObject



18
19
20
# File 'lib/orb/rails_template.rb', line 18

def return_buffer
  buffer == '@output_buffer' ? super : nil
end