Sha256: aa5d3001aa93570a3e5e59cfd949ca1c1f02bc230513f75bd9304c931b6e004e

Contents?: true

Size: 527 Bytes

Versions: 6

Compression:

Stored size: 527 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
      @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

6 entries across 6 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 lib/spontaneous/media/temp_file.rb
spontaneous-0.2.0.beta9 lib/spontaneous/media/temp_file.rb
spontaneous-0.2.0.beta8 lib/spontaneous/media/temp_file.rb
spontaneous-0.2.0.beta7 lib/spontaneous/media/temp_file.rb
spontaneous-0.2.0.beta6 lib/spontaneous/media/temp_file.rb
spontaneous-0.2.0.beta5 lib/spontaneous/media/temp_file.rb