Class: Tus::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/tus/response.rb

Overview

Object that responds to #each, #length, and #close, suitable for returning as a Rack response body.

Direct Known Subclasses

Storage::Filesystem::Response

Instance Method Summary collapse

Constructor Details

#initialize(chunks:, close: ->{}) ⇒ Response

Returns a new instance of Response.



5
6
7
8
# File 'lib/tus/response.rb', line 5

def initialize(chunks:, close: ->{})
  @chunks = chunks
  @close  = close
end

Instance Method Details

#closeObject



14
15
16
# File 'lib/tus/response.rb', line 14

def close
  @close.call
end

#each(&block) ⇒ Object



10
11
12
# File 'lib/tus/response.rb', line 10

def each(&block)
  @chunks.each(&block)
end