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)


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

#hashObject

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.

Parameters:

  • z (Float, Integer) (defaults to: 0)

Returns:



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_p2dself

Returns self

Returns:

  • (self)


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

def to_p2d = self