class MapPoint::Point

Attributes

x[RW]

Attributes access

y[RW]

Attributes access

z[RW]

Attributes access

Public Class Methods

new(x = 0, y = 0, z = 0) click to toggle source
# File lib/map/point.rb, line 5
def initialize(x = 0, y = 0, z = 0)
  @x, @y, @z = x, y, z
end

Public Instance Methods

==(other) click to toggle source

Redefinition of equal operator

# File lib/map/point.rb, line 13
def ==(other)
  (self.class ==other.class) && (self.state == other.state)
end
Also aliased as: eql?
eql?(other)

Use Point == for eql? method

Alias for: ==
hash() click to toggle source

It allows to use Point as a hash key

# File lib/map/point.rb, line 21
def hash
  state.hash
end
to_s() click to toggle source

To string

# File lib/map/point.rb, line 26
def to_s
  "(#{@x},#{@y},#{@z})"
end

Protected Instance Methods

state() click to toggle source
# File lib/map/point.rb, line 32
def state
  [x, y, z]
end