Sha256: 6c121d657fa1ceb1ce224cf95d3a64d139d442229b3ea2c479bae89b4467e5e2

Contents?: true

Size: 423 Bytes

Versions: 1

Compression:

Stored size: 423 Bytes

Contents

class Array
  extend Forwardable

  def sum
    inject(&:+)
  end

  def mean 
    sum / size
  end  

  # consider the array as a vector in n-space (where n is the self.length)
  def to_point
    Straightedge::Mark.new(*self)
  end
  def_delegators :to_point, :x, :y

  # consider the array as an array of points
  def to_points
    Straightedge::Figure.new(self)
  end
  def_delegators :to_points, :adjacent, :center
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
straightedge-0.1.0 lib/straightedge/extend/array.rb