Sha256: 7db8f537610def324b1a3efa5a7acf7fba59fb9da74b33e7da58eab5c3f8a7ae

Contents?: true

Size: 1.59 KB

Versions: 15

Compression:

Stored size: 1.59 KB

Contents

module CarrierWave
  module Uploader
    module Proxy

      ##
      # === Returns
      #
      # [Boolean] Whether the uploaded file is blank
      #
      def blank?
        file.blank?
      end

      ##
      # === Returns
      #
      # [String] the path where the file is currently located.
      #
      def current_path
        file.try(:path)
      end

      alias_method :path, :current_path

      ##
      # Returns a string that uniquely identifies the retrieved or last stored file
      #
      # === Returns
      #
      # [String] uniquely identifies a file
      #
      def identifier
        @identifier || storage.try(:identifier)
      end

      ##
      # Read the contents of the file
      #
      # === Returns
      #
      # [String] contents of the file
      #
      def read
        file.try(:read)
      end

      ##
      # Fetches the size of the currently stored/cached file
      #
      # === Returns
      #
      # [Integer] size of the file
      #
      def size
        file.try(:size) || 0
      end

      ##
      # Return the size of the file when asked for its length
      #
      # === Returns
      #
      # [Integer] size of the file
      #
      # === Note
      #
      # This was added because of the way Rails handles length/size validations in 3.0.6 and above.
      #
      def length
        size
      end

      ##
      # Read the content type of the file
      #
      # === Returns
      #
      # [String] content type of the file
      #
      def content_type
        file.try(:content_type)
      end

    end # Proxy
  end # Uploader
end # CarrierWave

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/carrierwave-2.2.6/lib/carrierwave/uploader/proxy.rb
carrierwave-2.2.6 lib/carrierwave/uploader/proxy.rb
carrierwave-2.2.5 lib/carrierwave/uploader/proxy.rb
carrierwave-2.2.4 lib/carrierwave/uploader/proxy.rb
carrierwave-2.2.3 lib/carrierwave/uploader/proxy.rb
carrierwave-3.0.0.beta lib/carrierwave/uploader/proxy.rb
carrierwave-2.2.2 lib/carrierwave/uploader/proxy.rb
carrierwave-2.2.1 lib/carrierwave/uploader/proxy.rb
carrierwave-2.2.0 lib/carrierwave/uploader/proxy.rb
carrierwave-2.1.1 lib/carrierwave/uploader/proxy.rb
carrierwave-2.1.0 lib/carrierwave/uploader/proxy.rb
carrierwave-2.0.2 lib/carrierwave/uploader/proxy.rb
carrierwave-2.0.1 lib/carrierwave/uploader/proxy.rb
carrierwave-2.0.0 lib/carrierwave/uploader/proxy.rb
carrierwave-2.0.0.rc lib/carrierwave/uploader/proxy.rb