PINCHme/area — pull request #1 by jackxxu (2014-01-28 20:46:44+00:00)
Title: Delay the area code and zip code loading till run time

Currently in area gem, the CSV data is loaded when the gem is loaded. However, because the size of the CSV file is rather large it takes a while (around 5s in my macbook) to load the data.

This change makes the loading JIT and thus saves a lot of time in the development environment. saves 4 seconds.

```
before this change:
➜ PinchMe git:(master) ✗ time bundle exec rake environment
bundle exec rake environment 16.96s user 2.45s system 92% cpu 21.100 total

after this change:
➜ PinchMe git:(master) ✗ time bundle exec rake environment
bundle exec rake environment 12.65s user 2.00s system 96% cpu 15.168 total
```

#### Changes involved
- load data during the first method call and use `instance_variable ||=
loading_function` ruby idiom to memorize the CSV data.
- create tests
- (not directly related to the functionality) ignore the .ruby-version
and ruby-gemset files.

#### Caveats and Solutions

- this is not thread-safe, but the original way is not thread-way anyway.
- the first person doing a zip/area code lookup will experience a long wait time.

we can get around the second issue by adding an initializer, which should look like the following:

```ruby
if Rails.env.production?
Area.zip_codes
Area.area_codes
end
```