Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4616

How to append a text to file succinctly

$
0
0

Instead of writing

File.open("foo.txt", "w"){|f| f.write("foo")}

We can write it

File.write("foo.txt", "foo")

Is there simpler way to write this one?

File.open("foo.txt", "a"){|f| f.write("foo")}

Viewing all articles
Browse latest Browse all 4616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>