Module: Dinja

Defined in:
lib/dinja.rb,
lib/dinja/rspec.rb,
lib/dinja/railtie.rb,
lib/dinja/version.rb,
lib/dinja/container.rb

Overview

Simple dependency injection

Defined Under Namespace

Modules: RSpec, Version Classes: Container, Railtie

Constant Summary collapse

VERSION =
Version::STRING

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loaderObject (readonly)

Code loader instance



9
10
11
# File 'lib/dinja.rb', line 9

def loader
  @loader
end

Class Method Details

.rootObject



11
12
13
# File 'lib/dinja.rb', line 11

def root
  @root ||= Pathname.new(File.expand_path(File.join("..", ".."), __FILE__))
end

.setupObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/dinja.rb', line 15

def setup
  @loader = Zeitwerk::Loader.for_gem

  # Register inflections
  require root.join("config/inflections.rb")

  # Do not eager load integrations
  loader.do_not_eager_load(root.join("lib/dinja/railtie.rb"))
  loader.do_not_eager_load(root.join("lib/dinja/rspec.rb"))

  loader.setup
  loader.eager_load
end