Sha256: e279cdedf5e134d49e964e065c1f3a731a6baeceb09ef49e02f1cedb39d58761
Contents?: true
Size: 804 Bytes
Versions: 3
Compression:
Stored size: 804 Bytes
Contents
module Api # Adds additional functionality to message object Api::Point2D module Point2DExtension # @private def hash [x, y].hash end def eql?(other) self.class == other.class && hash == other.hash end # Create a new 3d Point, by adding a y axis. # @return [Api::Point] def to_3d(z: 0) Api::Point[x, y, z] end # Adds additional functionality to message class Api::Point2D module ClassMethods # Shorthand for creating an instance for [x, y] # @example # Api::Point2D[2,4] # Where x is 2.0 and y is 4.0 # @return [Api::Point2D] def [](x, y) Api::Point2D.new(x: x, y: y) end end end end Api::Point2D.include Api::Point2DExtension Api::Point2D.extend Api::Point2DExtension::ClassMethods
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sc2ai-0.1.0 | lib/sc2ai/protocol/extensions/point_2_d.rb |
sc2ai-0.0.8 | lib/sc2ai/protocol/extensions/point_2_d.rb |
sc2ai-0.0.7 | lib/sc2ai/protocol/extensions/point_2_d.rb |