Class: AddressGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/address_matcher/address_group.rb

Instance Method Summary collapse

Constructor Details

#initializeAddressGroup

Returns a new instance of AddressGroup.



2
3
4
# File 'lib/address_matcher/address_group.rb', line 2

def initialize
  @store = {}
end

Instance Method Details

#[](lat_long) ⇒ Object



10
11
12
# File 'lib/address_matcher/address_group.rb', line 10

def [](lat_long)
  store[lat_long]
end

#[]=(lat_long, address) ⇒ Object



6
7
8
# File 'lib/address_matcher/address_group.rb', line 6

def []=(lat_long, address)
  store[lat_long] = address
end

#match(lat_long) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/address_matcher/address_group.rb', line 14

def match(lat_long)
  if exact = store[lat_long]
    exact
  else
    closest_match(lat_long)
  end
end