class MountableFileServer::Storage
Attributes
configuration[R]
Public Class Methods
new(configuration = MountableFileServer.config)
click to toggle source
# File lib/mountable_file_server/storage.rb, line 5 def initialize(configuration = MountableFileServer.config) @configuration = configuration end
Public Instance Methods
move_to_permanent_storage(uid)
click to toggle source
# File lib/mountable_file_server/storage.rb, line 21 def move_to_permanent_storage(uid) source = FileAccessor.new(uid, configuration).temporary_pathname destination = FileAccessor.new(uid, configuration).permanent_pathname destination.dirname.mkpath source.rename destination end
remove_from_storage(uid)
click to toggle source
# File lib/mountable_file_server/storage.rb, line 29 def remove_from_storage(uid) source = FileAccessor.new(uid, configuration).pathname source.delete end
store_permanent(uid, input)
click to toggle source
# File lib/mountable_file_server/storage.rb, line 15 def store_permanent(uid, input) destination = FileAccessor.new(uid, configuration).permanent_pathname destination.dirname.mkpath IO.copy_stream input, destination end
store_temporary(uid, input)
click to toggle source
# File lib/mountable_file_server/storage.rb, line 9 def store_temporary(uid, input) destination = FileAccessor.new(uid, configuration).temporary_pathname destination.dirname.mkpath IO.copy_stream input, destination end