Sha256: 3384744fd81edbf8938d45a99d3ac50549a4dada9c144c0d54e47c22e1674ec2

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

module CarrierWave
  module Storage
    class NosFile < CarrierWave::SanitizedFile
      attr_reader :path

      def initialize(uploader, base, path)
        @uploader = uploader
        @base = base
        @path = URI.encode(path)
      end

      def read
        object = bucket.get(@path)
        @headers = object.headers
        object
      end

      def store(file)
        bucket.put(@path, file)
      end

      def url(_opts = {})
        bucket.path_to_url(@path)
      end

      private

      def headers
        @headers ||= {}
      end

      def bucket
        return @bucket if defined? @bucket

        @bucket = CarrierWave::Nos::Bucket.new(@uploader)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
carrierwave-nos-0.1.0 lib/carrierwave/storage/nos_file.rb