Module: FFaker::Filesystem
Instance Method Summary
collapse
const_missing, k, luhn_check, underscore, unique
#fetch_sample, #rand, #shuffle
Instance Method Details
#directory(directory_separator = File::SEPARATOR) ⇒ Object
16
17
18
|
# File 'lib/ffaker/filesystem.rb', line 16
def directory(directory_separator = File::SEPARATOR)
Lorem.words.join(directory_separator)
end
|
#extension ⇒ Object
8
9
10
|
# File 'lib/ffaker/filesystem.rb', line 8
def extension
fetch_sample(EXTENSION)
end
|
#file_name(*args, dir: directory, name: Lorem.word.downcase, ext: extension, directory_separator: File::SEPARATOR) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/ffaker/filesystem.rb', line 20
def file_name(
*args,
dir: directory, name: Lorem.word.downcase, ext: extension, directory_separator: File::SEPARATOR
)
if args.any?
warn "Positional arguments for Filesystem##{__method__} are deprecated. Please use keyword arguments."
dir = args[0]
name = args[1] if args.size > 1
ext = args[2] if args.size > 2
directory_separator = args[3] if args.size > 3
end
"#{dir}#{directory_separator}#{name}.#{ext}"
end
|
#mime_type ⇒ Object
12
13
14
|
# File 'lib/ffaker/filesystem.rb', line 12
def mime_type
fetch_sample(MIME_TYPE)
end
|