PHP has a function file_put_contents(file, stuff) – is there any
similar single command in Ruby?
Thanks,
Joe
PHP has a function file_put_contents(file, stuff) – is there any
similar single command in Ruby?
Thanks,
Joe
On 10/13/06, Joe R. MUDCRAP-CE [email protected] wrote:
PHP has a function file_put_contents(file, stuff) – is there any
similar single command in Ruby?
file.puts(stuff)
If you don’t already have the file in question open for writing:
File.open(‘some_file.txt’,‘w’) {|file| file.puts stuff}
File gets most of its useful functionality from its parent, IO:
http://www.rubycentral.com/book/ref_c_io.html
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs