Method: Point2D#min
- Defined in:
- lib/cem/cruzzles.rb
#min(other) ⇒ Object
Returns the component-wise minimum as a new Point2D
Point2D.new(5,2).min(Point2D.new(1,3)) == Point2D.new(1,2) -> true
95 96 97 98 99 100 101 102 103 |
# File 'lib/cem/cruzzles.rb', line 95 def min(other) return self if !other if other.is_a? Array other.reduce(self) { |min, o| min.min(o) } else Point2D.new(Cem.min(x, other.x), Cem.min(y, other.y)) end end |