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



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/bootsnap/compile_cache/yaml.rb', line 344

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,
    nil,
    File.realpath(path),
    CompileCache::YAML::Psych3,
    kwargs,
  )
end

#unsafe_load_file(path, *args) ⇒ Object



365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/bootsnap/compile_cache/yaml.rb', line 365

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,
    nil,
    File.realpath(path),
    CompileCache::YAML::Psych3,
    kwargs,
  )
end