Module: Carbon::Concrete
- Defined in:
- lib/carbon/concrete.rb,
lib/carbon/concrete/item.rb,
lib/carbon/concrete/type.rb,
lib/carbon/concrete/build.rb,
lib/carbon/concrete/index.rb,
lib/carbon/concrete/item/base.rb,
lib/carbon/concrete/item/data.rb,
lib/carbon/concrete/type/name.rb,
lib/carbon/concrete/type/part.rb,
lib/carbon/concrete/item/class.rb,
lib/carbon/concrete/item/trait.rb,
lib/carbon/concrete/type/parse.rb,
lib/carbon/concrete/item/struct.rb,
lib/carbon/concrete/type/generic.rb,
lib/carbon/concrete/item/function.rb,
lib/carbon/concrete/item/internal.rb,
lib/carbon/concrete/type/function.rb,
lib/carbon/concrete/item/class/element.rb,
lib/carbon/concrete/item/struct/element.rb,
lib/carbon/concrete/item/trait/expectation.rb
Overview
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.
Defined Under Namespace
Modules: Item Classes: Build, Index, Type
Constant Summary collapse
- OPTIONS =
{ circular: true, class_cache: true }.freeze
Class Method Summary collapse
-
.dump(index) ⇒ ::String
private
Dumps an object to a string.
-
.load(source) ⇒ ::Object
private
Loads a dumped object into an instance.
Class Method Details
.dump(index) ⇒ ::String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
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).
40 41 42 43 |
# File 'lib/carbon/concrete.rb', line 40 def self.dump(index) raw = Oj.dump(index, OPTIONS) Zlib::Deflate.deflate(raw, 9) end |
.load(source) ⇒ ::Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
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.
27 28 29 30 |
# File 'lib/carbon/concrete.rb', line 27 def self.load(source) raw = Zlib::Inflate.inflate(source) Oj.load(raw, OPTIONS) end |