module Carbon::Concrete
A concrete representation of the global state of a compilation. All of the things within this module should be serializable, so that libraries may be linked easily back into the process.
Constants
- OPTIONS
Public Class Methods
Dumps an object to a string. If the object responds to `#to_basic`, the result of that method call is used instead. The object is then serialized, and then compressed using Zlib (Deflate).
@api private @see .load @param index [::Object] The object to dump. @return [::String] The dumped object.
# File lib/carbon/concrete.rb, line 40 def self.dump(index) raw = Oj.dump(index, OPTIONS) Zlib::Deflate.deflate(raw, 9) end
Loads a dumped object into an instance. The dumped object should be a Zlib compressed (with Deflate) string. The dumped object is decompressed and loaded, then passed to {.from}.
@api private @see .dump @param source [::String] The dumped object. @return [::Object] The represented object.
# File lib/carbon/concrete.rb, line 27 def self.load(source) raw = Zlib::Inflate.inflate(source) Oj.load(raw, OPTIONS) end