Module: RZstd
- Defined in:
- lib/rzstd.rb,
lib/rzstd/version.rb
Defined Under Namespace
Classes: Dictionary
Constant Summary collapse
- DEFAULT_LEVEL =
3- VERSION =
"0.3.0"
Class Method Summary collapse
-
.compress(bytes, level: DEFAULT_LEVEL) ⇒ Object
Wrap the native ‘_native_compress(bytes, level)` so callers get a `level:` kwarg with a sensible default.
-
.decompress(bytes, max_output_size: nil) ⇒ Object
Bounded single-shot decompression.
Class Method Details
.compress(bytes, level: DEFAULT_LEVEL) ⇒ Object
Wrap the native ‘_native_compress(bytes, level)` so callers get a `level:` kwarg with a sensible default. Defined as a real method (not a Proc-bound singleton method) so it remains Ractor-shareable.
15 16 17 |
# File 'lib/rzstd.rb', line 15 def self.compress(bytes, level: DEFAULT_LEVEL) _native_compress(bytes, Integer(level)) end |
.decompress(bytes, max_output_size: nil) ⇒ Object
Bounded single-shot decompression. When ‘max_output_size:` is given, the Rust extension reads the frame’s Frame_Content_Size header, raises MissingContentSizeError if absent, and raises OutputSizeLimitError if the declared size exceeds the limit — all before allocating the output buffer or invoking the decoder. When nil, frames without FCS fall back to a 1 MiB ceiling.
26 27 28 |
# File 'lib/rzstd.rb', line 26 def self.decompress(bytes, max_output_size: nil) _native_decompress(bytes, Integer(max_output_size || 0)) end |