# Erb rdoc wrong?

**URL:** <https://www.ruby-forum.com/t/erb-rdoc-wrong/70130>\
**Category:** Ruby\
**Created:** [February 18, 2006, 6:53pm UTC](https://www.ruby-forum.com/t/erb-rdoc-wrong/70130 "2006-02-18T18:53:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 18, 2006, 6:53pm UTC](https://www.ruby-forum.com/t/erb-rdoc-wrong/70130/1 "2006-02-18T18:53:28Z")

</div>

Greetings.

I am trying to use Erb to process a plain-text template. Following the  
RDoc  
documentation at  
[http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html](http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html), I can’t  
get  
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 = %q{  
From: James Edward G. II [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: \<%= to %\>  
Subject: Addressing Needs

```
<%= 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|
  * <%= priority %>
% end

Thanks for your patience.

James Edward G. II

```

}.gsub(/^ /, ‘’)

message = ERB.new(template, 0, “%\<\>”)

# Set up template data.

to = “Community Spokesman \<spokesman@ruby\_community.org\>”  
priorities = [ “Run Ruby Q.”,  
“Document Modules”,  
“Answer Questions on Ruby T.” ]

# Produce result.

email = message.result  
puts email

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 18, 2006, 7:11pm UTC](https://www.ruby-forum.com/t/erb-rdoc-wrong/70130/2 "2006-02-18T19:11:52Z")

</div>

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 G. II
