Module: SecID::DeepFreeze
- Defined in:
- lib/sec_id/deep_freeze.rb
Overview
Recursively freezes a nested structure of Hashes and Arrays and returns it. Used to make the CFI reference tables and their derived lookups deeply immutable in one call instead of freezing each level by hand.
Class Method Summary collapse
-
.call(object) ⇒ Object
The same object, deeply frozen.
Class Method Details
.call(object) ⇒ Object
Returns the same object, deeply frozen.
10 11 12 13 14 15 16 |
# File 'lib/sec_id/deep_freeze.rb', line 10 def self.call(object) case object when Hash then object.each_value { |value| call(value) } when Array then object.each { |value| call(value) } end object.freeze end |