Class: Ruvi::Point
- Inherits:
-
Struct
- Object
- Struct
- Ruvi::Point
- Includes:
- Comparable
- Defined in:
- lib/misc.rb,
lib/misc.rb
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x
3 4 5 |
# File 'lib/misc.rb', line 3 def x @x end |
#y ⇒ Object
Returns the value of attribute 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
6 7 8 |
# File 'lib/misc.rb', line 6 def nil? self.x.nil? || self.y.nil? end |