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 >> file.close! >> end >> > > Or even > >> >> > Tempfile.open(["hello_world", ".rb"], "./lib/generators") do |file| > #do stuff with file > end > > which closes the file for you at the end of the block. > > Fred
Thanks, trying to find out how to call a method contained in the file (method has same name as file) 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? > end -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

