Module: Dry::System::Plugins::Bootsnap
- Defined in:
- lib/dry/system/plugins/bootsnap.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ load_path_cache: true, compile_cache_iseq: true, compile_cache_yaml: true }.freeze
Class Method Summary collapse
- .dependencies ⇒ Object private
- .extended(system) ⇒ Object private
Instance Method Summary collapse
- #bootsnap_available? ⇒ Boolean private
-
#setup_bootsnap ⇒ Object
Set up bootsnap for faster booting.
Class Method Details
.dependencies ⇒ 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.
23 24 25 |
# File 'lib/dry/system/plugins/bootsnap.rb', line 23 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.
14 15 16 17 18 19 20 |
# File 'lib/dry/system/plugins/bootsnap.rb', line 14 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.
37 38 39 40 41 42 43 |
# File 'lib/dry/system/plugins/bootsnap.rb', line 37 def bootsnap_available? spec = Gem.loaded_specs["bootsnap"] or return false RUBY_ENGINE == "ruby" && spec.match_platform(RUBY_PLATFORM) && spec.required_ruby_version.satisfied_by?(Gem::Version.new(RUBY_VERSION)) end |
#setup_bootsnap ⇒ Object
Set up bootsnap for faster booting
30 31 32 33 34 |
# File 'lib/dry/system/plugins/bootsnap.rb', line 30 def setup_bootsnap return unless bootsnap_available? ::Bootsnap.setup(**config.bootsnap, cache_dir: root.join("tmp/cache").to_s) end |