Sha256: a8d1a0d7887f0850cc4b6696fbd51fdb93a322c94a2f040c34707ecef5a3a1cf

Contents?: true

Size: 311 Bytes

Versions: 1

Compression:

Stored size: 311 Bytes

Contents

module Geometer
  class Point < Struct.new(:x, :y)
    def inspect
      "(#{x},#{y})"
    end

    def -@
      Point.new(-x,-y)
    end

    def translate(other_point)
      dx,dy = *other_point
      Point.new(x+dx, y+dy)
    end
  end

  module PointHelpers
    def coord(x,y); Point.new(x,y) end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geometer-0.1.1 lib/geometer/point.rb