Sha256: 536befe1b53090b53831302ae351f04aff897dcae9286c1f15a0f5ab3985c149
Contents?: true
Size: 1020 Bytes
Versions: 1
Compression:
Stored size: 1020 Bytes
Contents
# frozen_string_literal: true module Runger 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 begin require "active_support/core_ext/hash/indifferent_access" rescue LoadError 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
runger_config-4.0.0 | lib/runger/ext/deep_freeze.rb |