Class: Weese::Location::RadiusAtCoordinates

Inherits:
Object
  • Object
show all
Defined in:
lib/weese/location.rb

Overview

A radius in meters at a Coordinates

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(radius, coordinates) ⇒ RadiusAtCoordinates

Create a Radius at a Coordinates

Parameters:

  • radius (Numeric)

    Distance in meters to check from the given coordinates

  • coordinates (Coordinates)

    Latitude and Longitude to



19
20
21
22
# File 'lib/weese/location.rb', line 19

def initialize(radius, coordinates)
  @radius = radius
  @coordinates = coordinates
end

Instance Attribute Details

#coordinatesCoordinates

Returns A latitude and longitude.

Returns:



11
12
13
# File 'lib/weese/location.rb', line 11

def coordinates
  @coordinates
end

#radiusNumeric

Returns Radius in meters around coordinates.

Returns:

  • (Numeric)

    Radius in meters around coordinates



9
10
11
# File 'lib/weese/location.rb', line 9

def radius
  @radius
end

Instance Method Details

#to_hHash

Converts this object to a hash

Returns:

  • (Hash)

    Hash containing radius, latitude and longitude



29
30
31
32
33
34
35
# File 'lib/weese/location.rb', line 29

def to_h
  {
    radius: radius,
    latitude: coordinates.latitude,
    longitude: coordinates.longitude
  }
end