Module: OnlyofficeS3Wrapper::PathHelper

Included in:
AmazonS3Wrapper
Defined in:
lib/onlyoffice_s3_wrapper/path_helper.rb

Overview

Module for method to work with paths

Instance Method Summary collapse

Instance Method Details

#bucket_file_path(filename, folder) ⇒ String

Returns correct full path to file.

Parameters:

  • filename (String)

    name of file to upload

  • folder (String)

    folder to upload file

Returns:

  • (String)

    correct full path to file



9
10
11
12
13
14
15
# File 'lib/onlyoffice_s3_wrapper/path_helper.rb', line 9

def bucket_file_path(filename, folder)
  return filename unless folder

  folder = folder.sub('/', '') if folder[0] == '/'
  folder = folder.chop if folder?(folder)
  "#{folder}/#{filename}"
end