Method: Point2D#max
- Defined in:
- lib/cem/cruzzles.rb
#max(other) ⇒ Object
Returns the component-wise maximum as a new Point2D
Point2D.new(5,2).min(Point2D.new(1,3)) == Point2D.new(5,3) -> true
109 110 111 112 113 114 115 116 117 |
# File 'lib/cem/cruzzles.rb', line 109 def max(other) return self if !other if other.is_a? Array other.reduce(self) { |max, o| max.max(o) } else Point2D.new(Cem.max(x, other.x), Cem.max(y, other.y)) end end |