Class: FroalaEditorSDK::Utils
- Inherits:
-
Object
- Object
- FroalaEditorSDK::Utils
- Defined in:
- lib/froala-editor-sdk/utils/utils.rb
Overview
Basic utility functionality.
Class Method Summary collapse
-
.get_file_name(path) ⇒ Object
Returns file name from an file path.
-
.name(file) ⇒ Object
Generates a random name that will be used as name for files.
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 |