Module: Bootsnap::CompileCache::YAML::Psych3
Defined Under Namespace
Modules: Patch
Instance Method Summary collapse
- #input_to_output(data, kwargs) ⇒ Object
- #input_to_storage(contents, _) ⇒ Object
- #storage_to_output(data, kwargs) ⇒ Object
Instance Method Details
#input_to_output(data, kwargs) ⇒ Object
289 290 291 |
# File 'lib/bootsnap/compile_cache/yaml.rb', line 289 def input_to_output(data, kwargs) ::YAML.load(data, **(kwargs || {})) end |
#input_to_storage(contents, _) ⇒ Object
267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/bootsnap/compile_cache/yaml.rb', line 267 def input_to_storage(contents, _) obj = ::YAML.load(contents) packer = CompileCache::YAML.msgpack_factory.packer packer.pack(false) # not safe loaded begin packer.pack(obj) rescue NoMethodError, RangeError return UNCOMPILABLE # The object included things that we can't serialize end packer.to_s end |
#storage_to_output(data, kwargs) ⇒ Object
279 280 281 282 283 284 285 286 287 |
# File 'lib/bootsnap/compile_cache/yaml.rb', line 279 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 unpacker.unpack end |