0.0
No commit activity in last 3 years
No release in over 3 years
small utility library for loading files in a priortized sort order
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

extended_dir

Build Status

library for prioritizing files in a directory according to load order

installation

in your Gemfile

gem "extended_dir"

usage

let's say one has a collection of files in a directory that depend on each other

  # /lib/core/base.rb
  module Core
    class Base;
      # /lib/extra/mixin.rb
      include Extra::Mixin
    end
  end
  # /lib/a.rb
  class A < Core::Base; end
  #/lib/b.rb
  class B < Core::Base; end
  # /script.rb
  require "extended_dir"
  files = ExtendedDir.files("#{__dir__}/lib", order: %w[extra/mixin.rb, core/base.rb])
  
  # the files are returned prioritized in the load order if specified, 
  # and in default sort order if not

  files #=> lib/extra/mixin.rb, lib/core/base.rb, lib/a.rb, lib/b.rb

  # or load them in order

  ExtendedDir.load_all("#{__dir__}/lib", order: %w[extra/mixin.rb, core/base.rb])

  # or require them in order

  ExtendedDir.require_all("#{__dir__}/lib", order: %w[extra/mixin.rb, core/base.rb])