Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ERB: Embedded Ruby

ERB: Embedded Ruby

A quick talk I gave on ERB at the Dallas Ruby Brigade during a tour of templating engines.

Aaron Lasseigne

February 03, 2015
Tweet

More Decks by Aaron Lasseigne

Other Decks in Programming

Transcript

  1. $SAFE • `nil` means do nothing • Anything else runs

    the code in a thread and uses that particular safe mode. • What are safe modes?
  2. Trim Modes • % enables Ruby code processing for lines

    beginning with % • <> omit newline for lines starting with <% and ending in %> • > omit newline for lines ending in %> • - omit blank lines ending in -%>
  3. Rails • Looks for your templates to have a “erb”

    extension. • Automatically turns on “-“ trim mode. • Automatically imports instance variables from your controller action. • Also imports `locals` passed in a `render` call.