Sha256: 4bf80a8b54b6ec28c7dd07ccd6e01c95ba16194abe6ef1a8c8ef4778a5ca7c29

Contents?: true

Size: 539 Bytes

Versions: 3

Compression:

Stored size: 539 Bytes

Contents

# encoding: UTF-8

require 'fileutils'

module Spontaneous::Media
  # Represents a temporary file used to provide a media file that is visible
  # publically under a /media/tmp/* URL for passing to file fields for
  # asynchronous processing
  class TempFile < File

    def storage
      Spontaneous::Site.default_storage
    end

    def media_dir
      F.join("tmp", padded_id)
    end

    def storage_path
      ["tmp", padded_id, filename]
    end

    def padded_id
      Spontaneous::Media.pad_id(owner.media_id)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta4 lib/spontaneous/media/temp_file.rb
spontaneous-0.2.0.beta3 lib/spontaneous/media/temp_file.rb
spontaneous-0.2.0.beta2 lib/spontaneous/media/temp_file.rb