Class: IPFS::IO::StreamProducer

Inherits:
Object
  • Object
show all
Defined in:
lib/ipfs-api/io.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ StreamProducer

Returns a new instance of StreamProducer.



9
10
11
# File 'lib/ipfs-api/io.rb', line 9

def initialize &block
  @block = block
end

Instance Method Details

#streamObject



13
14
15
16
17
18
19
20
21
# File 'lib/ipfs-api/io.rb', line 13

def stream
  io = Tempfile.new('ruby-ipfs')
  begin
    @block.call io
  ensure
    io.close
  end
  File.open(io.path, 'r')
end