Class: Array

Inherits:
Object
  • Object
show all
Includes:
GeoVector::Macros
Defined in:
lib/geo_vectors/core_ext.rb,
lib/geo_vectors/macros.rb

Overview

Should use sugar-high array ext in the future!

Direct Known Subclasses

GeoVectors

Instance Method Summary collapse

Methods included from GeoVector::Macros

#point_vector, #vector

Instance Method Details

#extract(sym) ⇒ Object



13
14
15
# File 'lib/geo_vectors/core_ext.rb', line 13

def extract(sym)
 map { |e| e.send(sym) }
end

#meanObject



21
22
23
# File 'lib/geo_vectors/core_ext.rb', line 21

def mean
 (size > 0) ? sum.to_f / size : 0
end

#sumObject



17
18
19
# File 'lib/geo_vectors/core_ext.rb', line 17

def sum
 inject( 0 ) { |sum,x| sum + x }
end

#to_pointObject



30
31
32
# File 'lib/geo_vectors/macros.rb', line 30

def to_point
  geo_point
end