# Capturing the Ruby generated by Erb

**URL:** <https://www.ruby-forum.com/t/capturing-the-ruby-generated-by-erb/158012>\
**Category:** Ruby\
**Created:** [January 17, 2009, 10:49pm UTC](https://www.ruby-forum.com/t/capturing-the-ruby-generated-by-erb/158012 "2009-01-17T22:49:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [January 17, 2009, 10:49pm UTC](https://www.ruby-forum.com/t/capturing-the-ruby-generated-by-erb/158012/1 "2009-01-17T22:49:54Z")

</div>

How can one capture the Ruby source file that gets generated from an Erb  
template?

Thanks,  
Wes

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [January 17, 2009, 11:50pm UTC](https://www.ruby-forum.com/t/capturing-the-ruby-generated-by-erb/158012/2 "2009-01-17T23:50:48Z")

</div>

2009/1/17 Wes G. :

> How can one capture the Ruby source file that gets generated  
> from an Erb template?

ERB#src

if you’ve got an erb file, you can use the command line erb (erb -x …  
)

– Jean-François.

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [January 18, 2009, 7:01pm UTC](https://www.ruby-forum.com/t/capturing-the-ruby-generated-by-erb/158012/3 "2009-01-18T19:01:26Z")

</div>

Many thanks. That is quite handy.

I did use it to discover that the \<% -%\> syntax doesn’t seem to matter  
anymore. Putting the hyphen before the end tag didn’t appear to  
suppress the “\n” at the end of the line on which it was used.

Again, thanks,  
Wes
