Sha256: 8bee64f09a8c53078da800ff005eaf076c522f75a16dab33f3a7b621a5e893fa

Contents?: true

Size: 1.17 KB

Versions: 29

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8

module CarrierWave
  module Storage

    ##
    # File storage stores file to the Filesystem (surprising, no?). There's really not much
    # to it, it uses the store_dir defined on the uploader as the storage location. That's
    # pretty much it.
    #
    class File < Abstract

      ##
      # Move the file to the uploader's store path.
      #
      # === Parameters
      #
      # [file (CarrierWave::SanitizedFile)] the file to store
      #
      # === Returns
      #
      # [CarrierWave::SanitizedFile] a sanitized file
      #
      def store!(file)
        path = ::File.expand_path(uploader.store_path, uploader.root)
        file.move_to(path, uploader.permissions)
        file
      end

      ##
      # Retrieve the file from its store path
      #
      # === Parameters
      #
      # [identifier (String)] the filename of the file
      #
      # === Returns
      #
      # [CarrierWave::SanitizedFile] a sanitized file
      #
      def retrieve!(identifier)
        path = ::File.expand_path(uploader.store_path(identifier), uploader.root)
        CarrierWave::SanitizedFile.new(path)
      end

    end # File
  end # Storage
end # CarrierWave

Version data entries

29 entries across 29 versions & 7 rubygems

Version Path
thorsson_carrierwave-0.4.12 lib/carrierwave/storage/file.rb
thorsson_carrierwave-0.4.11 lib/carrierwave/storage/file.rb
thorsson_carrierwave-0.4.10 lib/carrierwave/storage/file.rb
thorsson_carrierwave-0.4.9 lib/carrierwave/storage/file.rb
thorsson_carrierwave-0.4.8 lib/carrierwave/storage/file.rb
thorsson_carrierwave-0.4.6 lib/carrierwave/storage/file.rb
thorsson_carrierwave-0.4.5 lib/carrierwave/storage/file.rb
carrierwave-0.5.0 lib/carrierwave/storage/file.rb
carrierwave-0.4.10 lib/carrierwave/storage/file.rb
jswanner-carrierwave-0.5.0.beta3 lib/carrierwave/storage/file.rb
carrierwave-0.4.9 lib/carrierwave/storage/file.rb
carrierwave-0.5.0.beta2 lib/carrierwave/storage/file.rb
carrierwave-0.4.8 lib/carrierwave/storage/file.rb
carrierwave-0.4.7 lib/carrierwave/storage/file.rb
carrierwave-0.4.6 lib/carrierwave/storage/file.rb
carrierwave-rails3-0.4.5 lib/carrierwave/storage/file.rb
samlown-carrierwave-0.4.5 lib/carrierwave/storage/file.rb
dsturnbull-carrierwave-0.4.9 lib/carrierwave/storage/file.rb
dsturnbull-carrierwave-0.4.8 lib/carrierwave/storage/file.rb
dsturnbull-carrierwave-0.4.7 lib/carrierwave/storage/file.rb