Class: TranscodingMachine::Server::FileStorage
- Inherits:
-
Object
- Object
- TranscodingMachine::Server::FileStorage
- Defined in:
- lib/transcoding_machine/server/file_storage.rb
Instance Method Summary collapse
- #get_file(source_file_name, destination_file_path, options) ⇒ Object
-
#initialize(root_directory = '.') ⇒ FileStorage
constructor
A new instance of FileStorage.
- #put_file(source_file_path, destination_file_name, media_format, options) ⇒ Object
- #put_thumbnail_file(thumbnail_file_path, source_file, options) ⇒ Object
Constructor Details
#initialize(root_directory = '.') ⇒ FileStorage
Returns a new instance of FileStorage.
4 5 6 |
# File 'lib/transcoding_machine/server/file_storage.rb', line 4 def initialize(root_directory = '.') @root = root_directory end |
Instance Method Details
#get_file(source_file_name, destination_file_path, options) ⇒ Object
8 9 10 11 12 |
# File 'lib/transcoding_machine/server/file_storage.rb', line 8 def get_file(source_file_name, destination_file_path, ) puts File.(source_file_name, @root) puts destination_file_path FileUtils.cp(File.(source_file_name, @root), destination_file_path) end |
#put_file(source_file_path, destination_file_name, media_format, options) ⇒ Object
14 15 16 |
# File 'lib/transcoding_machine/server/file_storage.rb', line 14 def put_file(source_file_path, destination_file_name, media_format, ) FileUtils.mv(source_file_path, File.(destination_file_name, @root)) end |
#put_thumbnail_file(thumbnail_file_path, source_file, options) ⇒ Object
18 19 20 21 |
# File 'lib/transcoding_machine/server/file_storage.rb', line 18 def put_thumbnail_file(thumbnail_file_path, source_file, ) FileUtils.mv(thumbnail_file_path.path, @root) thumbnail_file_path.path end |