Module: Familia::Features::TransientFields::ModelClassMethods
- Defined in:
- lib/familia/features/transient_fields.rb
Instance Method Summary collapse
-
#transient_field(name, as: name, **kwargs) ⇒ Object
Define a transient field that automatically wraps values in RedactedString.
-
#transient_field?(field_name) ⇒ Boolean
Check if a field is transient.
-
#transient_fields ⇒ Array<Symbol>
Returns list of transient field names defined on this class.
Instance Method Details
#transient_field(name, as: name, **kwargs) ⇒ Object
Define a transient field that automatically wraps values in RedactedString
Transient fields are not persisted to Redis/Valkey and exist only in memory. All values are automatically wrapped in RedactedString for security.
142 143 144 145 146 147 148 149 150 |
# File 'lib/familia/features/transient_fields.rb', line 142 def transient_field(name, as: name, **kwargs) @transient_fields ||= [] @transient_fields << name unless @transient_fields.include?(name) # Use the field type system for proper integration require_relative 'transient_fields/transient_field_type' field_type = TransientFieldType.new(name, as: as, **kwargs.merge(fast_method: false)) register_field_type(field_type) end |
#transient_field?(field_name) ⇒ Boolean
Check if a field is transient
165 166 167 |
# File 'lib/familia/features/transient_fields.rb', line 165 def transient_field?(field_name) transient_fields.include?(field_name.to_sym) end |
#transient_fields ⇒ Array<Symbol>
Returns list of transient field names defined on this class
156 157 158 |
# File 'lib/familia/features/transient_fields.rb', line 156 def transient_fields @transient_fields || [] end |