<commit_before># Geolocal

Allows IP addresses to geocoded with a single Ruby if statement.
No network access, no context switches, no delay.  Just one low-calorie lookup:
`Geolocal.in_spain?(request.remote_ip)`

## Installation

Add this line to your Gemfile:

```ruby
gem 'geolocal'
```


## Usage

If you're using Rails, run `rails generate geolocal` to create the configuration file.
Otherwise, crib from [config/geolocal.rb](https://github.com/bronson/geolocal/tree/master/config/geolocal.rb).

The config file describes the ranges you're interested in.
Here's an example:

```ruby
Geolocal.configure do
  config.countries = {
    us: 'US',
    spain: 'ES',
    central_america: %w[ BZ CR SV GT HN NI PA ]
  }
end
```

Now run `rake geolocal:update`.  Geolocal downloads the geocoding data<commit_msg>typo fix in readme, thanks roamingdog<commit_after># Geolocal

Geocode IP addresses with a single Ruby if statement.
No network access, no context switches, no delay.  Just one low-calorie lookup:
`Geolocal.in_spain?(request.remote_ip)`

## Installation

Add this line to your Gemfile:

```ruby
gem 'geolocal'
```


## Usage

If you're using Rails, run `rails generate geolocal` to create the configuration file.
Otherwise, crib from [config/geolocal.rb](https://github.com/bronson/geolocal/tree/master/config/geolocal.rb).

The config file describes the ranges you're interested in.
Here's an example:

```ruby
Geolocal.configure do
  config.countries = {
    us: 'US',
    spain: 'ES',
    central_america: %w[ BZ CR SV GT HN NI PA ]
  }
end
```

Now run `rake geolocal:update`.  Geolocal downloads the geocoding data
{'fraction_non_alphanumeric': 0.10523076923076922, 'fraction_numerical': 0.0, 'mean_word_length': 4.313725490196078, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '31198', 'n_tokens_mistral': 572, 'n_tokens_neox': 535, 'n_words': 188}