Class: Ufo::Autoloader

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

Defined Under Namespace

Classes: Inflector

Class Method Summary collapse

Class Method Details

.setupObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/ufo/autoloader.rb', line 13

def setup
  loader = Zeitwerk::Loader.new
  loader.inflector = Inflector.new
  loader.push_dir(File.dirname(__dir__)) # lib

  helpers = "#{ufo_root}/.ufo/helpers"
  loader.push_dir(helpers) if File.exist?(helpers) # project helpers

  loader.setup
end

.ufo_rootObject

Autoloader runs so early that Ufo.root is not available, so we must declare it here



25
26
27
# File 'lib/ufo/autoloader.rb', line 25

def ufo_root
  ENV['UFO_ROOT'] || '.'
end