Sha256: 6d7598bb53d8726acdc82ba10853d77a40491df040b0c2fe24ef7dc9c0f6ecc1

Contents?: true

Size: 243 Bytes

Versions: 1

Compression:

Stored size: 243 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
end

Version data entries

1 entries across 1 versions & 1 rubygems

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