Module: XlsFunction::Extensions::ArrayExtension
- Defined in:
- lib/xls_function/extensions/array_extension.rb
Class Method Summary collapse
Class Method Details
.max_depth(array, depth = 1) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/xls_function/extensions/array_extension.rb', line 5 def max_depth(array, depth = 1) array.inject(depth) do |current_depth, item| next current_depth unless item.is_a?(Array) child_depth = max_depth(item, depth + 1) [current_depth, child_depth].max end end |