From: Chad Perrin Date: 2008-09-30T00:16:07+09:00 Subject: Re: erb reference anywhere online? --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 29, 2008 at 04:59:01PM +0900, Brian Candler wrote: > Chad Perrin wrote: > > On Fri, Sep 26, 2008 at 06:23:07PM +0900, Brian Candler wrote: > >> Rails locates a template, or how to factor code out into helper method= s)=20 > >> rather than Erb itself. > >=20 > > Me? No, I'm not talking about anything directly Rails-related. I, for > > instance, use an erb implementation all the time, and basically never= =20 > > use > > Rails. >=20 > As far as I understand it, raw ERB is just >=20 > ERB.new(File.read("/path/to/template")).result(binding) >=20 > You said: >=20 > "Greater visibility of certain documentation matters might be nice, too, > like all the default path and custom path definition stuff that goes on > when working with an erb implementation." >=20 > But that didn't make much sense to me, except in the context of some=20 > particular framework which uses ERB, where the framework will do things= =20 > like locating a template for a particular controller/action. >=20 > Can you give an example of what you mean? in a file: index.rhtml test file <% puts "
    " Dir.entries.each do |file| puts "
  1. #{file}
  2. " end puts "
" %> "default path" What directory's contents get listed with the above code? The answer is relatively easy to find out -- but more visible documentation of stuff like that might help eliminate a lot of flailing about, trying stuff in code just to see if it works as expected by a first guess, then deleting it and trying something different. --=20 Chad Perrin [ content licensed PDL: http://pdl.apotheon.org ] A: It reverses the normal flow of conversation. Q: What's wrong with top-posting? --lrZ03NoBR/3+SXJZ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkjg70oACgkQ9mn/Pj01uKXkWACfScdZJWuU3qyx6IGZNc1CX7Vd tGgAoIWrWVQ0sNAE5dHExdQK/5Jm/49E =IFel -----END PGP SIGNATURE----- --lrZ03NoBR/3+SXJZ--