Module: Bootsnap::CompileCache::YAML::Psych4::Patch

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

Instance Method Summary collapse

Instance Method Details

#load_file(path, *args) ⇒ Object



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/bootsnap/compile_cache/yaml.rb', line 222

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::Psych4::SafeLoad,
    kwargs,
  )
end

#unsafe_load_file(path, *args) ⇒ Object



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/bootsnap/compile_cache/yaml.rb', line 242

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::Psych4::UnsafeLoad,
    kwargs,
  )
end