class CarrierWave::Storage::GridFS::File

Attributes

grid[RW]
grid_file[R]
path[R]
uploader[R]

Public Class Methods

new(uploader, path) click to toggle source
# File lib/carrierwave/storage/grid_fs.rb, line 28
def initialize(uploader, path)
  @path = path
  @uploader = uploader
  @grid_file = nil
end

Public Instance Methods

read() click to toggle source
# File lib/carrierwave/storage/grid_fs.rb, line 52
def read
  grid_file.data if grid_file
end
url() click to toggle source
# File lib/carrierwave/storage/grid_fs.rb, line 34
def url
  unless @uploader.grid_fs_access_url
    nil
  else
    ::File.join(@uploader.grid_fs_access_url, path)
  end
end
write(file) click to toggle source
# File lib/carrierwave/storage/grid_fs.rb, line 46
def write(file)
  grid[@uploader.store_path] = file
ensure
  @grid_file = nil
end

Protected Instance Methods

grid() click to toggle source
# File lib/carrierwave/storage/grid_fs.rb, line 75
def grid
  self.class.grid
end