Module: Api::Point2DExtension
- Included in:
- Point2D
- Defined in:
- lib/sc2ai/protocol/extensions/point_2_d.rb
Overview
Adds additional functionality to message object Api::Point2D
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Object
Hashes on x and y.
-
#to_3d(z: 0) ⇒ Api::Point
Create a new 3d Point, by adding a y axis.
-
#to_p2d ⇒ self
Returns self.
Instance Method Details
#eql?(other) ⇒ Boolean
11 12 13 |
# File 'lib/sc2ai/protocol/extensions/point_2_d.rb', line 11 def eql?(other) self.class == other.class && hash == other.hash end |
#hash ⇒ Object
Hashes on x and y
6 7 8 |
# File 'lib/sc2ai/protocol/extensions/point_2_d.rb', line 6 def hash [x, y].hash end |
#to_3d(z: 0) ⇒ Api::Point
Create a new 3d Point, by adding a y axis.
22 23 24 |
# File 'lib/sc2ai/protocol/extensions/point_2_d.rb', line 22 def to_3d(z: 0) Api::Point[x, y, z] end |
#to_p2d ⇒ self
Returns self
17 |
# File 'lib/sc2ai/protocol/extensions/point_2_d.rb', line 17 def to_p2d = self |