demonstrate newline-handling nit
✓ Published0🌍 Public
RRichMorin
Last edited Jan 2, 2017
Created on Jan 2, 2017
This example demonstrates a newline-handling discrepancy between Sinatra’s Embedded Ruby (ERB) implementation and the standard Ruby ERB library. The code runs four template strings, each placing an interpolated value next to newlines in different configurations, then prints both sets of results to STDOUT and an HTML page. It shows that Sinatra’s `erb` method strips newlines when an interpolation sits alone on a line, while Ruby’s `ERB.new(...).result(binding)` preserves them. The source is a Ruby script using `erb`, `sinatra`, and a fixed array of test inputs.
AI-generated description