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



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

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



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

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