Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/zenweb/extensions.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#deep_each(depth = 0, &b) ⇒ Object

:nodoc:



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/zenweb/extensions.rb', line 25

def deep_each(depth = 0, &b) # :nodoc:
  return self.to_enum(:deep_each) unless b

  each do |x|
    case x
    when Array then
      x.deep_each(depth + 1, &b)
    else
      yield depth, x
    end
  end
end