Class: Array

Inherits:
Object show all
Defined in:
lib/awein/array.rb

Instance Method Summary collapse

Instance Method Details

#averageObject



2
3
4
# File 'lib/awein/array.rb', line 2

def average
  self.sum.to_f / self.length
end

#symbolize_keys_recursiveObject



6
7
8
9
10
11
12
13
# File 'lib/awein/array.rb', line 6

def symbolize_keys_recursive
  inject([]) do |options, value|
    value = value.symbolize_keys_recursive if value.instance_of? Hash
    value = value.symbolize_keys_recursive if value.instance_of? Array
    options << value
    options
  end
end