Skip to content

tskorupa/file_writer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

file_writer

Write to a tempfile on long jobs and replace the original once completed

Installation


Include this line in your Gemfile

gem "file_writer", github: "tskorupa/file_writer"

Usage


Use in the following fashion,

irb(main):001:0> require 'file_writer'
=> true
irb(main):002:0> handler = FileWriter.new(destination_dir: "/tmp", filename: "foo.txt")
=> #<FileWriter:0x007fe5218ba8e0 @destination_dir="/tmp", @filename="foo.txt", @encoding="UTF-8", @tempfile=#<Tempfile:/var/folders/cy/bmr4_rf90jq2v_n4y5b_l59c0000gn/T/foo.txt20151017-59874-16kd4v0>>
irb(main):003:0> handler.write "foo bar baz"
=> 11
irb(main):004:0> handler.finalize
=> #<Tempfile:>
irb(main):005:0>

TODO


  • test suite

About

Write to a tempfile on long jobs and replace the original once completed

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages