Class: Seg2D
- Inherits:
-
Struct
- Object
- Struct
- Seg2D
- Defined in:
- lib/cem/cruzzles.rb
Instance Attribute Summary collapse
-
#p1 ⇒ Object
Returns the value of attribute p1.
-
#p2 ⇒ Object
Returns the value of attribute p2.
Instance Method Summary collapse
Instance Attribute Details
#p1 ⇒ Object
Returns the value of attribute p1
124 125 126 |
# File 'lib/cem/cruzzles.rb', line 124 def p1 @p1 end |
#p2 ⇒ Object
Returns the value of attribute p2
124 125 126 |
# File 'lib/cem/cruzzles.rb', line 124 def p2 @p2 end |
Instance Method Details
#to_s ⇒ Object
125 126 127 |
# File 'lib/cem/cruzzles.rb', line 125 def to_s "#{p1},#{p2}" end |
#x_range ⇒ Object
129 130 131 132 133 134 135 |
# File 'lib/cem/cruzzles.rb', line 129 def x_range if p1.x < p2.x return p1.x..p2.x else return p2.x..p1.x end end |
#y_range ⇒ Object
137 138 139 140 141 142 143 |
# File 'lib/cem/cruzzles.rb', line 137 def y_range if p1.y < p2.y return p1.y..p2.y else return p2.y..p1.y end end |