Sha256: 5b091d9067583f4437effa162a86bd952466d2d03f94d4011965d99daa3b4a92
Contents?: true
Size: 908 Bytes
Versions: 8
Compression:
Stored size: 908 Bytes
Contents
# frozen_string_literal: true module Anyway module Ext # Add #deep_freeze to hashes and arrays module DeepFreeze refine ::Hash do def deep_freeze freeze each_value do |value| value.deep_freeze if value.is_a?(::Hash) || value.is_a?(::Array) end end end refine ::Array do def deep_freeze freeze each do |value| value.deep_freeze if value.is_a?(::Hash) || value.is_a?(::Array) end end end if defined?(::ActiveSupport::HashWithIndifferentAccess) refine ::ActiveSupport::HashWithIndifferentAccess do def deep_freeze freeze each_value do |value| value.deep_freeze if value.is_a?(::Hash) || value.is_a?(::Array) end end end end using self end end end
Version data entries
8 entries across 8 versions & 1 rubygems