Class: Mutant::LogCapture Private
- Inherits:
-
Object
- Object
- Mutant::LogCapture
- Includes:
- Unparser::AbstractType
- Defined in:
- lib/mutant/log_capture.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Captured log output from a worker or forked process.
Raw worker log bytes may or may not be valid UTF-8 — they commonly contain terminal control sequences emitted by test frameworks. This class preserves those bytes unaltered for terminal emission while distinguishing UTF-8 text from arbitrary bytes in the codec representation.
Defined Under Namespace
Constant Summary collapse
- CODEC =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Transform::Codec.new(dump_transform: dump, load_transform: load)
Class Method Summary collapse
-
.from_binary(bytes) ⇒ LogCapture
private
Build the appropriate subclass from raw bytes.
Class Method Details
.from_binary(bytes) ⇒ LogCapture
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.
Build the appropriate subclass from raw bytes.
Takes ownership of bytes; encoding is mutated in place.
20 21 22 23 24 25 26 |
# File 'lib/mutant/log_capture.rb', line 20 def self.from_binary(bytes) if bytes.force_encoding(Encoding::UTF_8).valid_encoding? String.new(content: bytes) else Binary.new(content: bytes.force_encoding(Encoding::ASCII_8BIT)) end end |