Class: WeatherSage::Census::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/weather-sage/census/match.rb

Overview

Matching address returned by Geocoder.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ctx, data) ⇒ Match

Create a new Match object.



10
11
12
13
14
15
16
17
18
# File 'lib/weather-sage/census/match.rb', line 10

def initialize(ctx, data)
  # get coordinates
  x, y = %w{x y}.map { |k| data['coordinates'][k] }

  # cache data, address, and point
  @data = data.freeze
  @address = @data['matchedAddress']
  @point = ::WeatherSage::Weather::Point.new(ctx, x, y).freeze
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



5
6
7
# File 'lib/weather-sage/census/match.rb', line 5

def address
  @address
end

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/weather-sage/census/match.rb', line 5

def data
  @data
end

#pointObject (readonly)

Returns the value of attribute point.



5
6
7
# File 'lib/weather-sage/census/match.rb', line 5

def point
  @point
end