Module: Nanoc::ArrayExtensions Private

Included in:
Array
Defined in:
lib/nanoc/base/core_ext/array.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#__nanoc_freeze_recursivelyvoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Freezes the contents of the array, as well as all array elements. The array elements will be frozen using #__nanoc_freeze_recursively if they respond to that message, or #freeze if they do not.

See Also:

  • Hash#__nanoc_freeze_recursively

Since:

  • 3.2.0



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/nanoc/base/core_ext/array.rb', line 25

def __nanoc_freeze_recursively
  return if frozen?
  freeze
  each do |value|
    if value.respond_to?(:__nanoc_freeze_recursively)
      value.__nanoc_freeze_recursively
    else
      value.freeze
    end
  end
end

#__nanoc_symbolize_keys_recursivelyArray

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new array where all items’ keys are recursively converted to symbols by calling #__nanoc_symbolize_keys_recursively or HashExtensions#__nanoc_symbolize_keys_recursively.

Returns:

  • (Array)

    The converted array



8
9
10
11
12
13
14
# File 'lib/nanoc/base/core_ext/array.rb', line 8

def __nanoc_symbolize_keys_recursively
  array = []
  each do |element|
    array << (element.respond_to?(:__nanoc_symbolize_keys_recursively) ? element.__nanoc_symbolize_keys_recursively : element)
  end
  array
end