module Hanami::Utils::FileList
Ordered file list, consistent across operating systems
@since 0.9.0
Public Class Methods
[](*args)
click to toggle source
Returns an ordered list of files, consistent across operating systems
It has the same signature of Dir.glob
, it just guarantees to order the results before to return them.
@since 0.9.0
@see 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" ]
# File lib/hanami/utils/file_list.rb, line 37 def self.[](*args) Dir.glob(::File.join(*args)).sort! end