Class: TopSecret::Text::BatchResult
- Inherits:
-
Object
- Object
- TopSecret::Text::BatchResult
- Includes:
- Mapping
- Defined in:
- lib/top_secret/text/batch_result.rb
Overview
Holds the result of a batch redaction operation on multiple messages. Contains a global mapping that ensures consistent labeling across all messages and a collection of individual input/output pairs.
Instance Attribute Summary collapse
-
#items ⇒ Array<Item>
readonly
Array of input/output pairs for each processed message.
-
#mapping ⇒ Hash
readonly
Global mapping of redaction labels to original values across all messages.
Class Method Summary collapse
-
.from_messages(messages, custom_filters: [], **filters) ⇒ BatchResult
Creates a BatchResult from multiple messages with consistent global labeling.
Instance Method Summary collapse
-
#initialize(mapping: {}, items: []) ⇒ BatchResult
constructor
Creates a new BatchResult instance.
Methods included from Mapping
#categories, #method_missing, #respond_to_missing?, #safe?, #sensitive?
Constructor Details
#initialize(mapping: {}, items: []) ⇒ BatchResult
Creates a new BatchResult instance
21 22 23 24 |
# File 'lib/top_secret/text/batch_result.rb', line 21 def initialize(mapping: {}, items: []) @mapping = mapping @items = items end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class TopSecret::Mapping
Instance Attribute Details
#items ⇒ Array<Item> (readonly)
Returns Array of input/output pairs for each processed message.
15 16 17 |
# File 'lib/top_secret/text/batch_result.rb', line 15 def items @items end |
#mapping ⇒ Hash (readonly)
Returns Global mapping of redaction labels to original values across all messages.
12 13 14 |
# File 'lib/top_secret/text/batch_result.rb', line 12 def mapping @mapping end |
Class Method Details
.from_messages(messages, custom_filters: [], **filters) ⇒ BatchResult
Creates a BatchResult from multiple messages with consistent global labeling
33 34 35 36 37 38 39 |
# File 'lib/top_secret/text/batch_result.rb', line 33 def self.(, custom_filters: [], **filters) individual_results = TopSecret::Text::Result.(, custom_filters:, **filters) mapping = TopSecret::Text::GlobalMapping.from_results(individual_results) items = TopSecret::Text::Result.with_global_labels(individual_results, mapping) Text::BatchResult.new(mapping:, items:) end |