Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #3553
| From | Brian Candler <b.candler@pobox.com> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Re: File.open of HTML file removes code |
| Date | 2011-04-27 02:49 -0500 |
| Organization | Service de news de lacave.net |
| Message-ID | <c1c6d5c520b80bd4b1bf31214611f456@ruby-forum.com> (permalink) |
| References | <f35f5a43da863832e708040011124ed4@ruby-forum.com> |
Scott Elwood wrote in post #995260:
> Hey there,
>
> I am trying to edit an erb file in ruby, however when I do:
>
> file.open("index.erb")
>
> It displays the information, but removes the Doctype, html, body, and
> head tags.
>
> Is there any way to read the entire contents of the .erb file?
File.open("...") just opens the file and returns an open File object,
but it doesn't read it until you ask it to.
Try:
File.open("index.erb") do |file|
file.each_line do |line|
puts line
end
end
--
Posted via http://www.ruby-forum.com/.
Back to comp.lang.ruby | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
File.open of HTML file removes code Scott Elwood <elwood32@live.com> - 2011-04-27 01:01 -0500
Re: File.open of HTML file removes code Nikita Baksalyar <n.baksalyar@yandex.ru> - 2011-04-27 01:52 -0500
Re: File.open of HTML file removes code Brian Candler <b.candler@pobox.com> - 2011-04-27 02:49 -0500
Re: File.open of HTML file removes code Scott Elwood <elwood32@live.com> - 2011-04-27 13:57 -0500
Re: File.open of HTML file removes code 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-27 19:39 -0500
Re: File.open of HTML file removes code Scott Elwood <elwood32@live.com> - 2011-04-28 01:14 -0500
csiph-web