Class: TxghServer::StreamResponse
- Inherits:
-
Object
- Object
- TxghServer::StreamResponse
show all
- Defined in:
- lib/txgh-server/stream_response.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(attachment, enum) ⇒ StreamResponse
Returns a new instance of StreamResponse.
7
8
9
10
|
# File 'lib/txgh-server/stream_response.rb', line 7
def initialize(attachment, enum)
@attachment = attachment
@enum = enum
end
|
Instance Attribute Details
#attachment ⇒ Object
Returns the value of attribute attachment.
5
6
7
|
# File 'lib/txgh-server/stream_response.rb', line 5
def attachment
@attachment
end
|
#enum ⇒ Object
Returns the value of attribute enum.
5
6
7
|
# File 'lib/txgh-server/stream_response.rb', line 5
def enum
@enum
end
|
Instance Method Details
#error ⇒ Object
33
34
35
|
# File 'lib/txgh-server/stream_response.rb', line 33
def error
nil
end
|
#file_extension ⇒ Object
17
18
19
20
|
# File 'lib/txgh-server/stream_response.rb', line 17
def file_extension
raise NotImplementedError,
"please implement #{__method__} in derived classes"
end
|
22
23
24
25
26
27
|
# File 'lib/txgh-server/stream_response.rb', line 22
def
@headers ||= {
'Content-Disposition' => "attachment; filename=\"#{attachment}#{file_extension}\"",
'Content-Type' => MIME::Types.type_for(file_extension).first.content_type
}
end
|
#streaming? ⇒ Boolean
29
30
31
|
# File 'lib/txgh-server/stream_response.rb', line 29
def streaming?
true
end
|
#write_to(stream) ⇒ Object
12
13
14
15
|
# File 'lib/txgh-server/stream_response.rb', line 12
def write_to(stream)
raise NotImplementedError,
"please implement #{__method__} in derived classes"
end
|