Class: BorderPatrol::Region

Inherits:
Set
  • Object
show all
Defined in:
lib/border_patrol/region.rb

Instance Method Summary collapse

Instance Method Details

#contains_point?(*point) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
# File 'lib/border_patrol/region.rb', line 3

def contains_point?(*point)
  point = case point.length
    when 1 then point.first
    when 2 then BorderPatrol::Point.new(point[0],point[1])
    else raise ArgumentError, "#{point} is invalid.  Arguments can either be an object, or a longitude,lattitude pair."
  end
  any? { |polygon| polygon.contains_point?(point) }
end