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