class Riffer::Guardrails::Modification
Records a guardrail transformation event.
When a guardrail transforms data (via +transform+), a Modification is created to record which guardrail made the change, in which phase, and which message indices were affected.
Attributes
The guardrail class that transformed data.
The indices of messages that were changed.
The phase when the transformation occurred (:before or :after).
Public Class Methods
Source
# File lib/riffer/guardrails/modification.rb, line 26 def initialize(guardrail:, phase:, message_indices:) @guardrail = guardrail @phase = phase @message_indices = message_indices end
Creates a new modification record.
+guardrail+ - the guardrail class that transformed. +phase+ - :before or :after. +message_indices+ - indices of changed messages.
: (guardrail: singleton(Riffer::Guardrail), phase: Symbol, message_indices: Array) -> void
Public Instance Methods
Source
# File lib/riffer/guardrails/modification.rb, line 35 def to_h { guardrail: guardrail.name, phase: phase, message_indices: message_indices } end
Converts the modification to a hash.
: () -> Hash[Symbol, untyped]