Class: OnlyofficePdfParser::FileHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/onlyoffice_pdf_parser/helpers/file_helper.rb

Overview

Class for working with files

Class Method Summary collapse

Class Method Details

.file_path?(string) ⇒ True, False

Returns if string is file path.

Returns:

  • (True, False)

    if string is file path



16
17
18
19
20
# File 'lib/onlyoffice_pdf_parser/helpers/file_helper.rb', line 16

def file_path?(string)
  File.exist?(string)
rescue ArgumentError
  false
end

.generate_temp_nameString

Returns name for temp file.

Returns:

  • (String)

    name for temp file



8
9
10
11
12
13
# File 'lib/onlyoffice_pdf_parser/helpers/file_helper.rb', line 8

def generate_temp_name
  file = Tempfile.new(%w[onlyoffice_bmp_parser .bmp])
  path = file.path
  file.unlink
  path
end