Class: Papa::Helper::Path

Inherits:
Object
  • Object
show all
Defined in:
lib/papa/helper/path.rb

Constant Summary collapse

TMP_PATH =
'/tmp/'
VI_PREFIX =
'papa-vi-'
SANDBOX_PREFIX =
'papa-sandbox-'

Class Method Summary collapse

Class Method Details

.generate_sandbox_path(type, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/papa/helper/path.rb', line 14

def self.generate_sandbox_path(type, options = {})
  path =
    if options.has_key?('override_path_prefix')
      options[:override_path_prefix] + '-' + type
    else
      SANDBOX_PREFIX + type + '-' +  uuid_gen
    end
  File.join(TMP_PATH, path)
end

.generate_vi_file_pathObject



10
11
12
# File 'lib/papa/helper/path.rb', line 10

def self.generate_vi_file_path
  File.join(TMP_PATH, VI_PREFIX + uuid_gen + '.txt')
end

.uuid_genObject



24
25
26
# File 'lib/papa/helper/path.rb', line 24

def self.uuid_gen
  SecureRandom.uuid
end