Method: GuiGeo::Rectangle#contains?

Defined in:
lib/gui_geometry/rectangle.rb

#contains?(val) ⇒ Boolean

Returns:

  • (Boolean)


77
78
79
80
81
82
83
84
85
86
# File 'lib/gui_geometry/rectangle.rb', line 77

def contains?(val)
  case val
  when nil then false
  when Point then
    val >= loc && val < (loc+size)
  when Rectangle then
    (self & val) == self
  else raise ArgumentError.new("wrong type: (#{val.class}) - Rectangle or Point expected")
  end
end