Sha256: b3c4575f90764a072a9166ad9e7ee3076cbc7d37b38befde6eb349dddf803fb9

Contents?: true

Size: 722 Bytes

Versions: 3

Compression:

Stored size: 722 Bytes

Contents

module Kernel

  private

  # Require a pattern of files. This make is easy
  # to require an entire directory, for instance.
  #
  #   require_all 'facets/core/time/*'
  #
  def require_all( pat )
    $LOAD_PATH.each do |path|
      fs = Dir[File.join(path,pat)]
      unless fs.empty?
        fs.each { |f|
          Kernel.require( f ) unless File.directory?( f )
        }
        break;
      end
    end
  end

end



#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCKernel < Test::Unit::TestCase

    def test_require_all
      assert_nothing_raised{ require_all 'facets/core/config/*' }
    end

  end

=end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-1.8.49 lib/facets/core/kernel/require_all.rb
facets-1.8.51 lib/facets/core/kernel/require_all.rb
facets-1.8.54 lib/facets/core/kernel/require_all.rb