Class: Wsv::Response::FileBuilder

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

Instance Method Summary collapse

Constructor Details

#initialize(path, head: false, range: nil, status: 200) ⇒ FileBuilder

Returns a new instance of FileBuilder.



9
10
11
12
13
14
# File 'lib/wsv/response/file_builder.rb', line 9

def initialize(path, head: false, range: nil, status: 200)
  @path = path
  @head = head
  @range = range
  @status = status
end

Instance Method Details

#buildObject



16
17
18
19
20
21
22
# File 'lib/wsv/response/file_builder.rb', line 16

def build
  if @range
    Response.new(status: 206, headers: range_headers, body: range_body)
  else
    Response.new(status: @status, headers: full_headers, body: full_body)
  end
end