Sha256: eb1533ad16edc2cbbf9dbef3a08047afe85bdceac58202978681e5d622c9103c

Contents?: true

Size: 835 Bytes

Versions: 1

Compression:

Stored size: 835 Bytes

Contents

# frozen_string_literal: true

module FFaker
  module Filesystem
    extend ModuleUtils
    extend self

    def extension
      fetch_sample(EXTENSION)
    end

    def mime_type
      fetch_sample(MIME_TYPE)
    end

    def directory(directory_separator = File::SEPARATOR)
      Lorem.words.join(directory_separator)
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffaker-2.23.0 lib/ffaker/filesystem.rb