Class: IntervalResponse::Invalid
Overview
Serves out a response that is of size 0
Constant Summary
collapse
- ERROR_JSON =
'{"message": "Ranges cannot be satisfied"}'
ToRackResponseTriplet::CHUNK_SIZE
Instance Method Summary
collapse
#to_rack_response_triplet
Constructor Details
#initialize(segment_map) ⇒ Invalid
Returns a new instance of Invalid.
7
8
9
|
# File 'lib/interval_response/invalid.rb', line 7
def initialize(segment_map)
@interval_map = segment_map
end
|
Instance Method Details
#content_length ⇒ Object
20
21
22
|
# File 'lib/interval_response/invalid.rb', line 20
def content_length
ERROR_JSON.bytesize
end
|
#each {|ERROR_JSON, full_segment_range| ... } ⇒ Object
11
12
13
14
|
# File 'lib/interval_response/invalid.rb', line 11
def each
full_segment_range = (0..(ERROR_JSON.bytesize - 1))
yield(ERROR_JSON, full_segment_range)
end
|
24
25
26
27
28
29
30
31
32
|
# File 'lib/interval_response/invalid.rb', line 24
def
{
'Accept-Ranges' => 'bytes',
'Content-Length' => ERROR_JSON.bytesize.to_s,
'Content-Type' => 'application/json',
'Content-Range' => "bytes */#{@interval_map.size}",
'ETag' => @interval_map.etag,
}
end
|
#status_code ⇒ Object
16
17
18
|
# File 'lib/interval_response/invalid.rb', line 16
def status_code
416
end
|