Class: Bulldog::Stream::ForTempfile
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(target) ⇒ ForTempfile
constructor
A new instance of ForTempfile.
- #path ⇒ Object
- #size ⇒ Object
Methods inherited from Base
#content_type, #file_name, #missing?, #reload, #write_to
Constructor Details
#initialize(target) ⇒ ForTempfile
Returns a new instance of ForTempfile.
101 102 103 104 105 |
# File 'lib/bulldog/stream.rb', line 101 def initialize(target) super @path = target.path or raise ArgumentError, "Tempfile is closed - cannot retrieve information" end |
Instance Method Details
#path ⇒ Object
107 108 109 110 |
# File 'lib/bulldog/stream.rb', line 107 def path @target.flush unless @target.closed? super end |
#size ⇒ Object
112 113 114 115 116 |
# File 'lib/bulldog/stream.rb', line 112 def size # Tempfile#size returns nil when closed. @target.flush unless @target.closed? File.size(@target.path) end |