Module: FFaker::Filesystem

Extended by:
Filesystem, ModuleUtils
Included in:
Filesystem
Defined in:
lib/ffaker/filesystem.rb

Constant Summary collapse

SLUG_DELIMITERS =
%w[- _ .].freeze

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#extensionObject


10
11
12
# File 'lib/ffaker/filesystem.rb', line 10

def extension
  fetch_sample(EXTENSION)
end

#file_name(dir = nil, name = nil, ext = nil, directory_separator = '/') ⇒ Object


18
19
20
21
22
23
# File 'lib/ffaker/filesystem.rb', line 18

def file_name(dir = nil, name = nil, ext = nil, directory_separator = '/')
  dir ||= Internet.slug
  name ||= Lorem.word.downcase
  ext ||= extension
  [dir, name].join(directory_separator) + ".#{ext}"
end

#mime_typeObject


14
15
16
# File 'lib/ffaker/filesystem.rb', line 14

def mime_type
  fetch_sample(MIME_TYPE)
end