Class: Rubino::Compression::CompressionResult
- Inherits:
-
Data
- Object
- Data
- Rubino::Compression::CompressionResult
- Defined in:
- lib/rubino/compression/compression_result.rb
Overview
Immutable result of one compression attempt. applied? is the single gate
the caller checks: when false, text is meaningless (use the original) and
saved_tokens_est is zeroed. When true, text is the skeleton and
saved_tokens_est is the estimated saving. strategy is :skeleton (or the
per-type tag) when applied, otherwise the no-op REASON (:not_full_file/
:not_code/:too_small/:parse_error/:insufficient_saving) for measurement events.
Instance Attribute Summary collapse
-
#applied ⇒ Object
readonly
Returns the value of attribute applied.
-
#saved_tokens_est ⇒ Object
readonly
Returns the value of attribute saved_tokens_est.
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Class Method Summary collapse
-
.noop(strategy:) ⇒ Object
The no-op result: nothing was compressed, the caller sends the original.
Instance Method Summary collapse
Instance Attribute Details
#applied ⇒ Object (readonly)
Returns the value of attribute applied
22 23 24 |
# File 'lib/rubino/compression/compression_result.rb', line 22 def applied @applied end |
#saved_tokens_est ⇒ Object (readonly)
Returns the value of attribute saved_tokens_est
22 23 24 |
# File 'lib/rubino/compression/compression_result.rb', line 22 def saved_tokens_est @saved_tokens_est end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy
22 23 24 |
# File 'lib/rubino/compression/compression_result.rb', line 22 def strategy @strategy end |
#text ⇒ Object (readonly)
Returns the value of attribute text
22 23 24 |
# File 'lib/rubino/compression/compression_result.rb', line 22 def text @text end |
Class Method Details
.noop(strategy:) ⇒ Object
The no-op result: nothing was compressed, the caller sends the original.
30 31 32 |
# File 'lib/rubino/compression/compression_result.rb', line 30 def self.noop(strategy:) new(text: nil, saved_tokens_est: 0, strategy: strategy, applied: false) end |
Instance Method Details
#applied? ⇒ Boolean
25 26 27 |
# File 'lib/rubino/compression/compression_result.rb', line 25 def applied? applied end |