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

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (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

#hashObject



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.

Returns:



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_p2dself

Returns self

Returns:

  • (self)


15
# File 'lib/sc2ai/protocol/extensions/point_2_d.rb', line 15

def to_p2d = self