Module: PrettierPrint::Buffer
- Defined in:
- lib/prettier_print.rb
Overview
When building up the contents in the output buffer, it’s convenient to be able to trim trailing whitespace before newlines. If the output object is a string or array or strings, then we can do this with some gsub calls. If not, then this effectively just wraps the output object and forwards on calls to <<.
Defined Under Namespace
Classes: ArrayBuffer, StringBuffer
Class Method Summary collapse
-
.for(output) ⇒ Object
This is a switch for building the correct output buffer wrapper class for the given output object.
Class Method Details
.for(output) ⇒ Object
This is a switch for building the correct output buffer wrapper class for the given output object.
336 337 338 |
# File 'lib/prettier_print.rb', line 336 def self.for(output) output.is_a?(String) ? StringBuffer.new(output) : ArrayBuffer.new(output) end |