Sha256: 2eced882053b7205f1170ee888b70812973d3fbb1aab64abc86f58ae2f1952eb
Contents?: true
Size: 1.25 KB
Versions: 17
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true module Hanami module Utils # Ordered file list, consistent across operating systems # # @since 0.9.0 module FileList # Returns an ordered list of files, consistent across operating systems # # It has the same signature of <tt>Dir.glob</tt>, it just guarantees to # order the results before to return them. # # @since 0.9.0 # # @see https://ruby-doc.org/core/Dir.html#method-c-glob # # @example simple usage # require "hanami/utils/file_list" # # Hanami::Utils::FileList["spec/support/fixtures/file_list/*.rb"] # # => [ # "spec/support/fixtures/file_list/a.rb", # "spec/support/fixtures/file_list/aa.rb", # "spec/support/fixtures/file_list/ab.rb" # ] # # @example token usage # require "hanami/utils/file_list" # # Hanami::Utils::FileList["spec", "support", "fixtures", "file_list", "*.rb"] # # => [ # "spec/support/fixtures/file_list/a.rb", # "spec/support/fixtures/file_list/aa.rb", # "spec/support/fixtures/file_list/ab.rb" # ] def self.[](*args) Dir.glob(::File.join(*args)).sort! end end end end
Version data entries
17 entries across 17 versions & 1 rubygems