Re: file_put_contents analog?

From: Gavin K.

contents.each{ |item|
  file << item
}

}
end

Er, missing a paren there. Also, if you want append vs. wipe-and-write,
use ‘a’:
def file_put_contents( name, *contents )
File.open( name, “a” ){ |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