[Rails] Re: Re: Write to tempfile

2012-09-04 Thread Dave Castellano
Hassan Schroeder wrote in post #1074525: On Mon, Sep 3, 2012 at 7:57 PM, Dave Castellano li...@ruby-forum.com wrote: I am placing an undefined method after file.write(Hello). Crashes the program and leaves the file so I can open it - its empty... Interesting programming style :-)

[Rails] Re: Re: Write to tempfile

2012-09-04 Thread Jordon Bedwell
On Tuesday, 4 September 2012 06:27:52 UTC-5, Ruby-Forum.com User wrote: Yes, I'm learning to program on my own... I don't believe anyone would pay for my work :-) Thanks, you were right - it is writing to the file and I can see it after closing. Can I follow with one last question...

[Rails] Re: Re: Write to tempfile

2012-09-04 Thread Frederick Cheung
On Tuesday, September 4, 2012 12:49:29 PM UTC+1, Jordon Bedwell wrote: I would personally write that method to be a little safer IMO. Yeah it's true that you can sometimes guarantee that problems won't happen but relying on that slim chance is bad, it's better to let file closing

[Rails] Re: Re: Write to tempfile

2012-09-04 Thread Dave Castellano
Frederick Cheung wrote in post #1074604: On Tuesday, September 4, 2012 12:49:29 PM UTC+1, Jordon Bedwell wrote: file.rewind $stdout.puts file.read # Will output the source without evaling. # raise # Uncomment this line to see what I mean about ensure. ensure

Re: [Rails] Re: Re: Write to tempfile

2012-09-04 Thread Hassan Schroeder
On Tue, Sep 4, 2012 at 9:37 AM, Dave Castellano li...@ruby-forum.com wrote: Tempfile.open([hello_world, .rb], ./lib/generators) do |file| If the file is a method, how can I call the method here and get the returned arguments? The file can't be a method, but it may contain a string describing