Class: IntervalResponse::Empty

Inherits:
Object
  • Object
show all
Includes:
ToRackResponseTriplet
Defined in:
lib/interval_response/empty.rb

Overview

Serves out a response that is of size 0

Constant Summary

Constants included from ToRackResponseTriplet

ToRackResponseTriplet::CHUNK_SIZE

Instance Method Summary collapse

Methods included from ToRackResponseTriplet

#to_rack_response_triplet

Constructor Details

#initialize(interval_map) ⇒ Empty

Returns a new instance of Empty.



5
6
7
# File 'lib/interval_response/empty.rb', line 5

def initialize(interval_map)
  @interval_map = interval_map
end

Instance Method Details

#content_lengthObject



17
18
19
# File 'lib/interval_response/empty.rb', line 17

def content_length
  0
end

#eachObject



9
10
11
# File 'lib/interval_response/empty.rb', line 9

def each
  # No-op
end

#headersObject



21
22
23
24
25
26
27
28
# File 'lib/interval_response/empty.rb', line 21

def headers
  {
    'Accept-Ranges' => 'bytes',
    'Content-Length' => '0',
    'Content-Type' => 'binary/octet-stream',
    'ETag' => @interval_map.etag,
  }
end

#status_codeObject



13
14
15
# File 'lib/interval_response/empty.rb', line 13

def status_code
  200
end