Class: Is::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/is/point.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lat, long) ⇒ Point

Returns a new instance of Point.



6
7
8
9
# File 'lib/is/point.rb', line 6

def initialize(lat, long)
  @latitude = lat.to_f
  @longitude = long.to_f
end

Instance Attribute Details

#latitudeObject (readonly)

Returns the value of attribute latitude.



4
5
6
# File 'lib/is/point.rb', line 4

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



4
5
6
# File 'lib/is/point.rb', line 4

def longitude
  @longitude
end

Instance Method Details

#in?(area) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/is/point.rb', line 11

def in?(area)
  area = Is::Area.new(area) unless area.is_a?(Is::Area) # :)
  area.contains? self
end