Module: Bootsnap::CompileCache::YAML::Psych3::Patch

Defined in:
lib/bootsnap/compile_cache/yaml.rb

Instance Method Summary collapse

Instance Method Details

#load_file(path, *args) ⇒ Object



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/bootsnap/compile_cache/yaml.rb', line 296

def load_file(path, *args)
  return super unless CompileCache::YAML.supported_internal_encoding?

  return super if args.size > 1

  if (kwargs = args.first)
    return super unless kwargs.is_a?(Hash)
    return super unless (kwargs.keys - CompileCache::YAML.supported_options).empty?
  end

  CompileCache::Native.fetch(
    CompileCache::YAML.cache_dir,
    File.realpath(path),
    CompileCache::YAML::Psych3,
    kwargs,
  )
end

#unsafe_load_file(path, *args) ⇒ Object



316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/bootsnap/compile_cache/yaml.rb', line 316

def unsafe_load_file(path, *args)
  return super unless CompileCache::YAML.supported_internal_encoding?

  return super if args.size > 1

  if (kwargs = args.first)
    return super unless kwargs.is_a?(Hash)
    return super unless (kwargs.keys - CompileCache::YAML.supported_options).empty?
  end

  CompileCache::Native.fetch(
    CompileCache::YAML.cache_dir,
    File.realpath(path),
    CompileCache::YAML::Psych3,
    kwargs,
  )
end