Class: IPFS::IO::StreamProducer
- Inherits:
-
Object
- Object
- IPFS::IO::StreamProducer
- Defined in:
- lib/ipfs-api/io.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(&block) ⇒ StreamProducer
constructor
A new instance of StreamProducer.
- #stream ⇒ Object
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
#stream ⇒ Object
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 |