Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Ruby: Open A File, Write To It, And Close It In One Line

DZone's Guide to

Ruby: Open A File, Write To It, And Close It In One Line

· Web Dev Zone ·
Free Resource

Deploying code to production can be filled with uncertainty. Reduce the risks, and deploy earlier and more often. Download this free guide to learn more. Brought to you in partnership with Rollbar.


File.open(local_filename, 'w') {|f| f.write(doc) }


Deploying code to production can be filled with uncertainty. Reduce the risks, and deploy earlier and more often. Download this free guide to learn more. Brought to you in partnership with Rollbar.

Topics:
ruby

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}