Class: BFS::Writer

Inherits:
Tempfile
  • Object
show all
Includes:
Mixin
Defined in:
lib/bfs/helpers.rb

Defined Under Namespace

Modules: Mixin

Instance Method Summary collapse

Methods included from Mixin

#commit, #discard, #perform

Constructor Details

#initialize(name, tempdir: nil, perm: nil, **opts, &on_commit) ⇒ Writer

Returns a new instance of Writer.



36
37
38
39
40
41
42
# File 'lib/bfs/helpers.rb', line 36

def initialize(name, tempdir: nil, perm: nil, **opts, &on_commit)
  @on_commit = on_commit

  tempfile = ::Tempfile.new(File.basename(name.to_s), tempdir, **opts)
  tempfile.chmod(perm) if perm
  super tempfile
end