Sha256: 90cc792e9accd84d9c65c5cc4d1ab8fcd848fd08e583e94cd00786574d3833cd
Contents?: true
Size: 363 Bytes
Versions: 10
Compression:
Stored size: 363 Bytes
Contents
module JustGo Vector = Struct.new(:origin, :destination) do def magnitude if dx.abs == 0 dy.abs elsif dy.abs == 0 dx.abs else nil end end def orthogonal? dx == 0 || dy == 0 end def dx destination.x - origin.x end def dy destination.y - origin.y end end end
Version data entries
10 entries across 10 versions & 1 rubygems