![]() ![]() Must be flexible to change and have the ability to work effectively in a team environment. Note that in this example, we use the convenient “% at start of line” tag, and we quote the template literally with %q to avoid trouble with the backslash. Perform phlebotomy on all ages of patients. Examples ¶ ↑ Plain Text ¶ ↑ĮRB is useful for any generic templating situation. # -*- coding: utf-8 -*- require 'erb' template = ERB. When the input string has a magic comment, however, it returns a string in the encoding specified by the magic comment. Character encodings ¶ ↑ĮRB (or Ruby code generated by ERB) returns a string in the same character encoding as the input string. See the ERB.new and ERB#result methods for more detail. The binding used to resolve local variables in the template. The value of $SAFE under which the template is run The nature of the tags that are recognized ![]() There are several settings you can change when you use ERB: %% replaced with % if first thing on a line and % processing is usedĪll other text is passed through ERB filtering unchanged. % a line of Ruby code - treated as (optional - see ERB.new) Recognized Tags ¶ ↑ĮRB recognizes certain tags in the provided template and converts them based on the rules below: ![]() ![]() Using ERB, actual Ruby code can be added to any plain text document for the purposes of generating document information details and/or flow control.Ī very simple example is this: require 'erb' x = 42 template = ERB. ERB – Ruby Templating ¶ ↑ Introduction ¶ ↑ĮRB provides an easy to use but powerful templating system for Ruby. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |