Embedded in the string are a pair of template tags, <%= and %>. : Embedded Ruby « Development « Ruby






Embedded in the string are a pair of template tags, <%= and %>.



#!/usr/bin/env ruby

require 'erb'

person = "myValue!"

temp = ERB.new( "Hello, <%= person %>" )

puts temp.result( binding ) # => Hello, myValue!

 








Related examples in the same category

1.Embedded Ruby
2.ERB template tags
3.ERB tags in a string
4.Nested ERB block