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
-
#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
9 10 11 |
# File 'lib/sc2ai/protocol/extensions/point_2_d.rb', line 9 def eql?(other) self.class == other.class && hash == other.hash end |
#hash ⇒ Object
5 6 7 |
# File 'lib/sc2ai/protocol/extensions/point_2_d.rb', line 5 def hash [x, y].hash end |
#to_3d(z: 0) ⇒ Api::Point
Create a new 3d Point, by adding a y axis.
19 20 21 |
# File 'lib/sc2ai/protocol/extensions/point_2_d.rb', line 19 def to_3d(z: 0) Api::Point[x, y, z] end |
#to_p2d ⇒ self
Returns self
15 |
# File 'lib/sc2ai/protocol/extensions/point_2_d.rb', line 15 def to_p2d = self |