Sha256: 3d4da2b27f3b8f062a89f90e787c95ba3f1d2ce4adfcd2d34b62570fb643dda9

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

module Draught
  module Pointlike
    def x
      raise NotImplementedError, "including classes must return an x value"
    end

    def y
      raise NotImplementedError, "including classes must return an y value"
    end

    def point_type
      raise NotImplementedError, "including classes must return a Symbol with their point type"
    end

    def ==(other)
      raise NotImplementedError, "including classes must implement equality checking. It's assumed other point_types are always unequal"
    end

    def approximates?(other, delta)
      raise NotImplementedError, "including classes must implement approximate equality checking. It's assumed other point_types are always unequal"
    end

    def translate(vector)
      raise NotImplementedError, "including classes must return a new instance translated by the vector arg"
    end

    def transform(transformer)
      raise NotImplementedError, "including classes must return a new instance transformed by the Affine transform or lambda Point-based transform supplied"
    end

    def points
      [self]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
draught-0.1.0 lib/draught/pointlike.rb