Class: HttpStub::Server::StubResponse::File

Inherits:
Base
  • Object
show all
Defined in:
lib/http_stub/server/stub_response/file.rb

Instance Attribute Summary

Attributes inherited from Base

#body, #delay_in_seconds, #headers, #status

Instance Method Summary collapse

Methods inherited from Base

add_default_headers, #empty?, merge_defaults, #to_s

Constructor Details

#initialize(args) ⇒ File

Returns a new instance of File.



9
10
11
12
# File 'lib/http_stub/server/stub_response/file.rb', line 9

def initialize(args)
  @file_path = args["body"][:tempfile].path
  super(args.merge("body" => @file_path))
end

Instance Method Details

#serve_on(server) ⇒ Object



14
15
16
# File 'lib/http_stub/server/stub_response/file.rb', line 14

def serve_on(server)
  server.send_file(@file_path, send_options)
end