Class: Array

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

Instance Method Summary collapse

Instance Method Details

#flatten(depth = -1)) ⇒ Object



195
196
197
198
199
200
201
202
203
204
205
# File 'lib/sfl.rb', line 195

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



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

alias orig_flatten flatten