Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Erb rdoc wrong?

Reply
Thread Tools

Erb rdoc wrong?

 
 
Belorion
Guest
Posts: n/a
 
      02-18-2006
------=_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/libdo...asses/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 <(E-Mail Removed)>
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--


 
Reply With Quote
 
 
 
 
James Edward Gray II
Guest
Posts: n/a
 
      02-18-2006
On Feb 18, 2006, at 11:53 AM, Belorion wrote:

> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
link to .erb file, from .erb file Dan Thomas Ruby 4 01-26-2011 09:26 PM
Store erb block and alter scope of erb block eval? Steve V Ruby 6 04-20-2005 09:26 PM
[RDOC] Using a template causes rdoc not to document some classes Daniel Berger Ruby 1 11-02-2004 08:23 PM
rdoc bug (and rdoc bug tracker site is down) Brian Schröder Ruby 5 09-18-2004 02:08 PM
rdoc: how to generate rdoc & ri documentation of standard library? Andreas Schwarz Ruby 6 01-01-2004 03:09 AM



Advertisments