Class: Array

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

Instance Method Summary collapse

Instance Method Details

#flatten(depth = -1)) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
# File 'lib/sfl.rb', line 118

def flatten(depth = -1)
  if depth < 0
    orig_flatten
  elsif depth == 0
    self
  else
    inject([]) {|m, i|
      Array === i ? m + i : m << i
    }.flatten(depth - 1)
  end
end

#orig_flattenObject



116
# File 'lib/sfl.rb', line 116

alias orig_flatten flatten