Over a million developers have joined DZone.
Silver Partner

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

· Web Dev Zone

The Web Dev Zone is brought to you in partnership with JetBrains. Produce high quality code with no additional effort, thanks to state-of-the-art code analysis, on-the-fly error prevention with PhpStorm.


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


The Web Dev Zone is brought to you in partnership with JetBrains. Streamline your workflow by integrating with everything you need for productive development with WebStorm.

Topics:
ruby

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

{{ parent.tldr }}

{{ parent.urlSource.name }}