Module: Trax::Core::EagerLoadNamespace

Defined in:
lib/trax/core/eager_load_namespace.rb

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/trax/core/eager_load_namespace.rb', line 4

def self.extended(base)
  source_file_path = caller[0].partition(":")[0]

  base.module_attribute(:eager_autoload_filepath) { source_file_path }
  base.module_attribute(:module_path) { ::Pathname.new(::File.path(base.eager_autoload_filepath).gsub(".rb", "")) }

  ::Trax::Core::FS::Directory.new(base.module_path).files.each do |file|
    load file
  end

  super(base)
end