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
213 214 215 |
# File 'lib/cem/cruzzles.rb', line 213 def p1 @p1 end |
#p2 ⇒ Object
Returns the value of attribute p2
213 214 215 |
# File 'lib/cem/cruzzles.rb', line 213 def p2 @p2 end |
Instance Method Details
#to_s ⇒ Object
214 215 216 |
# File 'lib/cem/cruzzles.rb', line 214 def to_s "#{p1},#{p2}" end |
#x_range ⇒ Object
218 219 220 221 222 223 224 |
# File 'lib/cem/cruzzles.rb', line 218 def x_range if p1.x < p2.x return p1.x..p2.x else return p2.x..p1.x end end |
#y_range ⇒ Object
226 227 228 229 230 231 232 |
# File 'lib/cem/cruzzles.rb', line 226 def y_range if p1.y < p2.y return p1.y..p2.y else return p2.y..p1.y end end |