Class: CarrierWave::Storage::GridFS::File
- Defined in:
- lib/carrierwave/storage/grid_fs.rb
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(uploader, database, path) ⇒ File
constructor
A new instance of File.
- #path ⇒ Object
- #read ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(uploader, database, path) ⇒ File
Returns a new instance of File.
15 16 17 18 19 |
# File 'lib/carrierwave/storage/grid_fs.rb', line 15 def initialize(uploader, database, path) @database = database @path = path @uploader = uploader end |
Instance Method Details
#delete ⇒ Object
37 38 39 |
# File 'lib/carrierwave/storage/grid_fs.rb', line 37 def delete ::GridFS::GridStore.unlink(@database, @path) end |
#path ⇒ Object
21 22 23 |
# File 'lib/carrierwave/storage/grid_fs.rb', line 21 def path nil end |
#read ⇒ Object
33 34 35 |
# File 'lib/carrierwave/storage/grid_fs.rb', line 33 def read ::GridFS::GridStore.read(@database, @path) end |
#url ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/carrierwave/storage/grid_fs.rb', line 25 def url unless @uploader.grid_fs_access_url nil else [@uploader.grid_fs_access_url, @path].join("/") end end |