Project

General

Profile

Actions

Feature #2509

closed

Recursive freezing?

Added by marcandre (Marc-Andre Lafortune) almost 15 years ago. Updated over 10 years ago.

Status:
Rejected
Target version:
[ruby-core:27256]

Description

=begin
I like freezing my constants, config files I read, etc... I believe it is the typical use case for #freeze.

In all theses cases, what I really want to do is freeze everything. There is often no easy way to do this (e.g. for config files), or else one must explicitly call freeze a bunch of times, like:

DEFAULT_SEND_FILE_OPTIONS = {
:type => 'application/octet-stream'.freeze,
:disposition => 'attachment'.freeze,
}.freeze

It would be very nice if there was an easy way to freeze recursively arrays, hashes, etc...

A solution would be for #freeze to accept a level argument (similar to flatten, but the default being 1), or alternatively a boolean one (recursive = false).

Should I write a patch for this feature request?

Thanks,

Marc-André
=end


Files

deep_freeze.pdf (90.8 KB) deep_freeze.pdf marcandre (Marc-Andre Lafortune), 08/31/2013 08:59 AM

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #17145: Ractor-aware `Object#deep_freeze`RejectedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0