Sha256: c5470ac57789df461b7506817920b5401c8a5d4c6631c7c8d6dae0d1fada2257

Contents?: true

Size: 938 Bytes

Versions: 6

Compression:

Stored size: 938 Bytes

Contents

module Bootsnap
  module CompileCache
    def self.setup(cache_dir:, iseq:, yaml:)
      if iseq
        if supported?
          require_relative('compile_cache/iseq')
          Bootsnap::CompileCache::ISeq.install!(cache_dir)
        elsif $VERBOSE
          warn("[bootsnap/setup] bytecode caching is not supported on this implementation of Ruby")
        end
      end

      if yaml
        if supported?
          require_relative('compile_cache/yaml')
          Bootsnap::CompileCache::YAML.install!(cache_dir)
        elsif $VERBOSE
          warn("[bootsnap/setup] YAML parsing caching is not supported on this implementation of Ruby")
        end
      end
    end

    def self.supported?
      # only enable on 'ruby' (MRI), POSIX (darwin, linux, *bsd), and >= 2.3.0
      RUBY_ENGINE == 'ruby' &&
      RUBY_PLATFORM =~ /darwin|linux|bsd/ &&
      Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.3.0")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bootsnap-1.4.1-java lib/bootsnap/compile_cache.rb
bootsnap-1.4.1 lib/bootsnap/compile_cache.rb
bootsnap-1.4.0 lib/bootsnap/compile_cache.rb
bootsnap-1.4.0-java lib/bootsnap/compile_cache.rb
bootsnap-1.4.0.pre3 lib/bootsnap/compile_cache.rb
bootsnap-1.4.0.pre2 lib/bootsnap/compile_cache.rb