Class: Terraspace::Autoloader

Inherits:
Object
  • Object
show all
Defined in:
lib/terraspace/autoloader.rb

Defined Under Namespace

Classes: Inflector

Class Method Summary collapse

Class Method Details

.project_helpersObject



34
35
36
# File 'lib/terraspace/autoloader.rb', line 34

def project_helpers
  "#{ts_root}/config/helpers"
end

.setupObject



24
25
26
27
28
29
30
31
32
# File 'lib/terraspace/autoloader.rb', line 24

def setup
  loader = Zeitwerk::Loader.new
  loader.inflector = Inflector.new
  loader.push_dir(File.dirname(__dir__)) # lib
  loader.push_dir(project_helpers, namespace: Terraspace::Project) if File.exist?(project_helpers)
  loader.log! if ENV["TS_AUTOLOAD_LOG"]
  loader.ignore("#{__dir__}/ext.rb")
  loader.setup
end

.ts_rootObject

Duplicate definition because autoloader logic runs very early and doesnt have access to core methods yet



39
40
41
# File 'lib/terraspace/autoloader.rb', line 39

def ts_root
  ENV['TS_ROOT'] || Dir.pwd
end