module Bootsnap::CompileCache::YAML::Psych4::SafeLoad
Public Instance Methods
Source
# File lib/bootsnap/compile_cache/yaml.rb, line 213 def input_to_output(data, kwargs) ::YAML.load(data, **(kwargs || {})) end
Source
# File lib/bootsnap/compile_cache/yaml.rb, line 181 def input_to_storage(contents, _) obj = begin CompileCache::YAML.strict_load(contents) rescue Psych::DisallowedClass, Psych::BadAlias, Uncompilable return UNCOMPILABLE end packer = CompileCache::YAML.msgpack_factory.packer packer.pack(true) # safe loaded begin packer.pack(obj) rescue NoMethodError, RangeError return UNCOMPILABLE end packer.to_s end
Source
# File lib/bootsnap/compile_cache/yaml.rb, line 198 def storage_to_output(data, kwargs) if kwargs&.key?(:symbolize_names) kwargs[:symbolize_keys] = kwargs.delete(:symbolize_names) end unpacker = CompileCache::YAML.msgpack_factory.unpacker(kwargs) unpacker.feed(data) safe_loaded = unpacker.unpack if safe_loaded unpacker.unpack else UNCOMPILABLE end end