Module: Api::PointExtension
- Defined in:
- lib/sc2ai/protocol/extensions/point.rb
Overview
Adds additional functionality to message object Api::Point
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#to_p2d ⇒ Api::Point2D
Creates a Point2D using x and y.
Instance Method Details
#eql?(other) ⇒ Boolean
11 12 13 |
# File 'lib/sc2ai/protocol/extensions/point.rb', line 11 def eql?(other) self.class == other.class && hash == other.hash end |
#hash ⇒ Object
5 6 7 8 9 |
# File 'lib/sc2ai/protocol/extensions/point.rb', line 5 def hash # Only one plane is ever used. Ignore hashing on z # [x, y, z].hash [x, y].hash end |
#to_p2d ⇒ Api::Point2D
Creates a Point2D using x and y
17 18 19 |
# File 'lib/sc2ai/protocol/extensions/point.rb', line 17 def to_p2d Api::Point2D.new(x: x, y: y) end |