Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/core_ext/ruby/array/flatten_once.rb

Instance Method Summary collapse

Instance Method Details

#flatten_onceObject



2
3
4
5
6
7
8
# File 'lib/core_ext/ruby/array/flatten_once.rb', line 2

def flatten_once
  result = []
  for element in self # a little faster than each
    result.push(*element)
  end
  result
end