HiveBrain v1.2.0
Get Started
← Back to all entries
snippetrubyCritical

How to write to file in Ruby?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
writehowfileruby

Problem

I need to read the data out of database and then save it in a text file.

How can I do that in Ruby? Is there any file management system in Ruby?

Solution

The Ruby File class will give you the ins and outs of ::new and ::open but its parent, the IO class, gets into the depth of #read and #write.

Context

Stack Overflow Q#2777802, score: 194

Revisions (0)

No revisions yet.