Class: Point2D::Float
- Inherits:
-
Object
- Object
- Point2D::Float
- Defined in:
- lib/tabula/core_ext.rb
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #hash ⇒ Object
- #inspect ⇒ Object
- #to_json(*args) ⇒ Object
- #x_first_cmp(other) ⇒ Object
Instance Method Details
#<=>(other) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/tabula/core_ext.rb', line 56 def <=>(other) return 1 if self.y > other.y return -1 if self.y < other.y return 1 if self.x > other.x return -1 if self.x < other.x return 0 end |
#==(other) ⇒ Object
72 73 74 |
# File 'lib/tabula/core_ext.rb', line 72 def ==(other) return self.x == other.x && self.y == other.y end |
#hash ⇒ Object
52 53 54 |
# File 'lib/tabula/core_ext.rb', line 52 def hash "#{self.getX},#{self.getY}".hash end |
#inspect ⇒ Object
44 45 46 |
# File 'lib/tabula/core_ext.rb', line 44 def inspect toString end |
#to_json(*args) ⇒ Object
48 49 50 |
# File 'lib/tabula/core_ext.rb', line 48 def to_json(*args) [self.getX, self.getY].to_json(*args) end |
#x_first_cmp(other) ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/tabula/core_ext.rb', line 64 def x_first_cmp(other) return 1 if self.x > other.x return -1 if self.x < other.x return 1 if self.y > other.y return -1 if self.y < other.y return 0 end |