Module: SecApi::DeepFreezable

Included in:
ExtractedData, Fact, Objects::StreamFiling, XbrlData
Defined in:
lib/sec_api/deep_freezable.rb

Overview

Mixin module providing deep freeze functionality for immutable value objects.

Include this module in Dry::Struct classes that need to ensure nested hashes and arrays are recursively frozen for thread-safety.

Examples:

Usage in a Dry::Struct class

class MyObject < Dry::Struct
  include SecApi::DeepFreezable

  attribute :data, Types::Hash

  def initialize(attributes)
    super
    deep_freeze(data) if data
    freeze
  end
end