Class: Array

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

Instance Method Summary collapse

Instance Method Details

#flatten(depth = -1)) ⇒ Object



202
203
204
205
206
207
208
209
210
211
212
# File 'lib/sfl.rb', line 202

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



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

alias orig_flatten flatten