Sha256: 396ec1a36064c1239f04682c570350fcad521047dbb5c9f97c2edc6cacde9a4e

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 Bytes

Contents

# encoding: utf-8

module IceNine
  class Freezer

    # A freezer class for handling Array objects
    class Array < Object

      # Deep Freeze an Array
      #
      # @example
      #   array = IceNine:Freezer::Array.deep_freeze(%w[a b c])
      #   array.select(&:frozen?)  # => ['a', 'b', 'c']
      #
      # @param [Array] array
      # @param [RecursionGuard] recursion_guard
      #
      # @return [Array]
      #
      # @api public
      def self.deep_freeze(array, recursion_guard = RecursionGuard.new)
        array.each do |entry|
          IceNine.deep_freeze(entry, recursion_guard)
        end
        super
      end

    end # class Array
  end # class Freezer
end # module IceNine

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ice_nine-0.10.0 lib/ice_nine/freezer/array.rb