Class: HttpStub::Server::Stub::Response::File
- Defined in:
- lib/http_stub/server/stub/response/file.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Attributes inherited from Base
#body, #delay_in_seconds, #headers, #status
Instance Method Summary collapse
-
#initialize(args) ⇒ File
constructor
A new instance of File.
- #serve_on(server) ⇒ Object
Methods inherited from Base
add_default_headers, #empty?, merge_defaults, #to_s, #type
Constructor Details
#initialize(args) ⇒ File
Returns a new instance of File.
12 13 14 15 16 |
# File 'lib/http_stub/server/stub/response/file.rb', line 12 def initialize(args) @file = args["body"][:tempfile] @uri = "file://#{@file.path}" super(args.merge("body" => "")) end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
10 11 12 |
# File 'lib/http_stub/server/stub/response/file.rb', line 10 def uri @uri end |
Instance Method Details
#serve_on(server) ⇒ Object
18 19 20 |
# File 'lib/http_stub/server/stub/response/file.rb', line 18 def serve_on(server) server.send_file(@file.path, ) end |