Class: Ruvi::Point

Inherits:
Struct
  • Object
show all
Includes:
Comparable
Defined in:
lib/misc.rb,
lib/misc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#xObject

Returns the value of attribute x

Returns:

  • (Object)

    the current value of x



3
4
5
# File 'lib/misc.rb', line 3

def x
  @x
end

#yObject

Returns the value of attribute y

Returns:

  • (Object)

    the current value of y



3
4
5
# File 'lib/misc.rb', line 3

def y
  @y
end

Instance Method Details

#==(b) ⇒ Object



9
10
11
12
# File 'lib/misc.rb', line 9

def == b
    a = self
    a.x == b.x and a.y == b.y
end

#>(b) ⇒ Object



13
14
15
16
17
# File 'lib/misc.rb', line 13

def > b
    raise "comparison against nil" if b.nil? # temp work around for crap thread debugging
    a = self
    (a.y > b.y) || (a.y == b.y && a.x > b.x)
end

#nil?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/misc.rb', line 6

def nil?
    self.x.nil? || self.y.nil?
end