Class: Array

Inherits:
Object show all
Defined in:
lib/ultrasphinx/core_extensions.rb

Instance Method Summary collapse

Instance Method Details

#_flatten_onceObject

Only flatten the first level of an array



4
5
6
7
8
# File 'lib/ultrasphinx/core_extensions.rb', line 4

def _flatten_once
  self.inject([]) do |set, element| 
    set + Array(element)
  end
end

#_sumObject



10
11
12
13
14
# File 'lib/ultrasphinx/core_extensions.rb', line 10

def _sum
  self.inject(0) do |acc, element|
    acc + element
  end
end