Class: AddressGroup
- Inherits:
-
Object
- Object
- AddressGroup
- Defined in:
- lib/address_matcher/address_group.rb
Instance Method Summary collapse
- #[](lat_long) ⇒ Object
- #[]=(lat_long, address) ⇒ Object
-
#initialize ⇒ AddressGroup
constructor
A new instance of AddressGroup.
- #match(lat_long) ⇒ Object
Constructor Details
#initialize ⇒ AddressGroup
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 |