Class: IntervalResponse::Full
Overview
Serves out a response that contains the entire resource
Constant Summary
ToRackResponseTriplet::CHUNK_SIZE
Instance Method Summary
collapse
#to_rack_response_triplet
Constructor Details
#initialize(interval_map) ⇒ Full
Returns a new instance of Full.
5
6
7
|
# File 'lib/interval_response/full.rb', line 5
def initialize(interval_map, *)
@interval_map = interval_map
end
|
Instance Method Details
#content_length ⇒ Object
21
22
23
|
# File 'lib/interval_response/full.rb', line 21
def content_length
@interval_map.size
end
|
#each ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/interval_response/full.rb', line 9
def each
full_range = 0..(@interval_map.size - 1)
@interval_map.each_in_range(full_range) do |segment, range_in_segment|
yield(segment, range_in_segment)
end
end
|
25
26
27
28
29
30
31
32
|
# File 'lib/interval_response/full.rb', line 25
def
{
'Accept-Ranges' => 'bytes',
'Content-Length' => @interval_map.size.to_s,
'Content-Type' => 'binary/octet-stream',
'ETag' => @interval_map.etag,
}
end
|
#status_code ⇒ Object
17
18
19
|
# File 'lib/interval_response/full.rb', line 17
def status_code
200
end
|