Re: file_put_contents analog?

From: Joe R. MUDCRAP-CE

PHP has a function file_put_contents(file, stuff) – is there any
similar single command in Ruby?

def file_put_contents( name, *contents )
File.open( name, “w+” { |file|
contents.each{ |item|
file << item
}
}
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs