Module: Helper::Upload

Included in:
Upload
Defined in:
lib/skynet/helper.rb

Overview

Module for keeping upload settings

Class Method Summary collapse

Class Method Details

.default_optionsObject

Default options for the upload module



36
37
38
39
40
41
42
43
44
# File 'lib/skynet/helper.rb', line 36

def self.default_options
  {
    portal_url: Helper::PORTAL_URL,
    portal_upload_path: 'skynet/skyfile',
    portal_file_fieldname: 'file',
    portal_directory_fieldname: 'files[]',
    custom_filename: nil
  }
end

.strip_dotslash_path(file_path) ⇒ Object

Removes “./” from a given filename if provided



47
48
49
50
51
52
53
54
55
# File 'lib/skynet/helper.rb', line 47

def self.strip_dotslash_path(file_path)
  return nil if file_path.nil?

  if file_path.start_with?('./')
    file_path.delete_prefix('./')
  else
    file_path
  end
end