class IntervalResponse::Full

Serves out a response that contains the entire resource

Public Class Methods

new(*) click to toggle source
Calls superclass method IntervalResponse::Abstract::new
# File lib/interval_response/full.rb, line 3
def initialize(*)
  super
  @http_range_for_entire_resource = 0..(@interval_sequence.size - 1)
end

Public Instance Methods

content_length() click to toggle source
# File lib/interval_response/full.rb, line 18
def content_length
  @interval_sequence.size
end
each() { |segment, range_in_segment| ... } click to toggle source
# File lib/interval_response/full.rb, line 8
def each
  @interval_sequence.each_in_range(@http_range_for_entire_resource) do |segment, range_in_segment|
    yield(segment, range_in_segment)
  end
end
headers() click to toggle source
# File lib/interval_response/full.rb, line 30
def headers
  {
    'Accept-Ranges' => 'bytes',
    'Content-Length' => @interval_sequence.size.to_s,
    'Content-Type' => 'binary/octet-stream',
    'ETag' => etag,
  }
end
multiple_ranges?() click to toggle source
# File lib/interval_response/full.rb, line 26
def multiple_ranges?
  false
end
satisfied_with_first_interval?() click to toggle source
# File lib/interval_response/full.rb, line 22
def satisfied_with_first_interval?
  @interval_sequence.first_interval_only?(@http_range_for_entire_resource)
end
status_code() click to toggle source
# File lib/interval_response/full.rb, line 14
def status_code
  200
end