Module: Dry::System::Plugins::Bootsnap

Defined in:
lib/dry/system/plugins/bootsnap.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  load_path_cache: true,
  disable_trace: true,
  compile_cache_iseq: true,
  compile_cache_yaml: true,
  autoload_paths_cache: false
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.dependenciesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/dry/system/plugins/bootsnap.rb', line 25

def self.dependencies
  {bootsnap: "bootsnap"}
end

.extended(system) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
19
20
21
22
# File 'lib/dry/system/plugins/bootsnap.rb', line 16

def self.extended(system)
  super

  system.use(:env)
  system.setting :bootsnap, default: DEFAULT_OPTIONS
  system.after(:configure, &:setup_bootsnap)
end

Instance Method Details

#bootsnap_available?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


39
40
41
# File 'lib/dry/system/plugins/bootsnap.rb', line 39

def bootsnap_available?
  RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.3.0" && RUBY_VERSION < "3.1.0"
end

#setup_bootsnapObject

Set up bootsnap for faster booting



32
33
34
35
36
# File 'lib/dry/system/plugins/bootsnap.rb', line 32

def setup_bootsnap
  return unless bootsnap_available?

  ::Bootsnap.setup(config.bootsnap.merge(cache_dir: root.join("tmp/cache").to_s))
end