Class: FroalaEditorSDK::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/froala-editor-sdk/utils/utils.rb

Overview

Basic utility functionality.

Class Method Summary collapse

Class Method Details

.get_file_name(path) ⇒ Object

Returns file name from an file path



15
16
17
# File 'lib/froala-editor-sdk/utils/utils.rb', line 15

def self.get_file_name(path)
  return ::File.basename(path)
end

.name(file) ⇒ Object

Generates a random name that will be used as name for files.



7
8
9
10
11
12
# File 'lib/froala-editor-sdk/utils/utils.rb', line 7

def self.name (file)
  name = SecureRandom.urlsafe_base64
  ext = ::File.extname(file.original_filename)

  return "#{name}#{ext}"
end