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.


22
23
24
# File 'lib/dry/system/plugins/bootsnap.rb', line 22

def self.dependencies
  '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.


14
15
16
17
18
19
# File 'lib/dry/system/plugins/bootsnap.rb', line 14

def self.extended(system)
  super
  system.use(:env)
  system.setting :bootsnap, 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)

35
36
37
# File 'lib/dry/system/plugins/bootsnap.rb', line 35

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

#setup_bootsnapObject

Set up bootsnap for faster booting


29
30
31
32
# File 'lib/dry/system/plugins/bootsnap.rb', line 29

def setup_bootsnap
  return unless bootsnap_available?
  ::Bootsnap.setup(config.bootsnap.merge(cache_dir: root.join('tmp/cache').to_s))
end