Erb rdoc wrong?

B

Belorion

------=_Part_8007_16432951.1140285180549
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Greetings.

I am trying to use Erb to process a plain-text template. Following the RDo=
c
documentation at
http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html, I can't ge=
t
the first plain-text example to work. ruby 1.8.2 (2004-12-25)
[i686-linux]. Below[1] is the actual sample script which isn't working
(it's not finding the local variables when processing the template). Any
ideas what's going on here? Thanks.

-Matt

[1]
require "erb"

# Create template.
template =3D %q{
From: James Edward Gray II <[email protected]>
To: <%=3D to %>
Subject: Addressing Needs

<%=3D to[/\w+/] %>:

Just wanted to send a quick note assuring that your needs are being
addressed.

I want you to know that my team will keep working on the issues,
especially:

<%# ignore numerous minor requests -- focus on priorities %>
% priorities.each do |priority|
* <%=3D priority %>
% end

Thanks for your patience.

James Edward Gray II
}.gsub(/^ /, '')

message =3D ERB.new(template, 0, "%<>")

# Set up template data.
to =3D "Community Spokesman <spokesman@ruby_community.org>"
priorities =3D [ "Run Ruby Quiz",
"Document Modules",
"Answer Questions on Ruby Talk" ]

# Produce result.
email =3D message.result
puts email

------=_Part_8007_16432951.1140285180549--
 
J

James Edward Gray II

Any ideas what's going on here?

Hmm, has ERB stopped defaulting to a top-level binding?
email = message.result

Change that to:

email = message.result(binding)

Can someone please patch the docs for me?

James Edward Gray II
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Erb on the Herb? 5
ERB: Format for trim_mode string 1
[ANN] RDoc 3 6
Daily erb Questions 0
Learning erb 7
[ANN] keybox 1.1.1 Released 0
Enhancing the Gateway (Help Needed) 24
Another erb Question 11

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top