Class: Jets::Autoloaders::Gem

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Defined in:
lib/jets/autoloaders/gem.rb

Overview

for jets gem itself

Defined Under Namespace

Classes: Inflector

Class Method Summary collapse

Class Method Details

.do_not_eager_loadObject



28
29
30
31
# File 'lib/jets/autoloaders/gem.rb', line 28

def do_not_eager_load
  paths = %w[]
  paths.map { |path| "#{lib}/#{path}" } # do_not_eager_load requires full dir or path
end

.ignore_pathsObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/jets/autoloaders/gem.rb', line 33

def ignore_paths
  # commands
  paths = %w[
    jets/cli/generate/templates
    jets/cli/init/templates
    jets/core_ext
    jets/core_ext.rb
    jets/overrides
    jets/shim/template
  ]
  paths.map { |path| "#{lib}/#{path}" }
end

.libObject



24
25
26
# File 'lib/jets/autoloaders/gem.rb', line 24

def lib
  File.expand_path("#{__dir__}/../..") # jets/lib
end

.loaderObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/jets/autoloaders/gem.rb', line 8

def loader
  loader = Zeitwerk::Loader.new
  loader.tag = "jets.gem"
  loader.inflector = Inflector.new
  loader.push_dir(lib)
  loader.do_not_eager_load(do_not_eager_load)
  loader.ignore(ignore_paths) # loader.ignore requires full dir or path
  # loader.log!
  loader
end

.setupObject



20
21
22
# File 'lib/jets/autoloaders/gem.rb', line 20

def setup
  loader.setup
end