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) ⇒ FileBuilder

Returns a new instance of FileBuilder.



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

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

Instance Method Details

#buildObject



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

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