jgv / area

Perform a variety of conversions between places and area codes or zip codes.
http://jonathanvingiano.com/area
MIT License
176 stars 58 forks source link

[feature] adding multiple option support to String#to_region #20

Closed brndnblck closed 8 years ago

brndnblck commented 10 years ago

@jgv thanks for providing this great gem!

I had a need to pull city and state separately from a zip code and I didn't want to do any string splitting or multiple searches. So, I added support for handling multiple options when calling String#to_region and I thought it might be useful to everyone.

This change keeps the existing API intact with no changes, but will now return an array of results if you pass multiple options.

"11211".to_region #=> "Brooklyn, NY"
"11211".to_region(:city => true) #=> "Brooklyn"
"11211".to_region(:city => true, :state => true) #=> ["Brooklyn", "NY"]