Module: Otto::Core::Freezable
- Included in:
- Configuration, MiddlewareStack, Locale::Config, Privacy::Config, Security::Config
- Defined in:
- lib/otto/core/freezable.rb
Overview
Provides deep freezing capability for configuration objects
This module enables objects to be deeply frozen, preventing any modifications to the object itself and all its nested structures. This is critical for security as it prevents runtime tampering with security configurations.
Instance Method Summary collapse
-
#deep_freeze! ⇒ self
Deeply freeze this object and all its instance variables.
Instance Method Details
#deep_freeze! ⇒ self
Deeply freeze this object and all its instance variables
This method recursively freezes all nested structures including:
-
Hashes (both keys and values)
-
Arrays (and all elements)
-
Sets
-
Other freezable objects
NOTE: This method is idempotent and safe to call multiple times.
39 40 41 42 43 44 45 |
# File 'lib/otto/core/freezable.rb', line 39 def deep_freeze! return self if frozen? freeze_instance_variables! freeze self end |