<commit_before># Insulate

TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'insulate'
```

And then execute:

```bash
$ bundle install
```

Lastly, add the following line to the application.js manifest after `//= require jquery` and before `//= require_tree .`:

```
//= require insulate
```

## Usage

It's all very simple. For every controller action that you want to hook into, just add a callback function to a global `Insulate` object. The key must be a string in the format `controller#action`.

CoffeeScript example:

```coffeescript
Insulate['users#new'] = ->
  alert 'Create a new user!'
```

JavaScript example:

```javascript
Insulate['users#edit'] = function() {
    alert('Edit an existing user!');
};
```

Any callback function you define this way will be executed on jQuery's `$(document).ready()` event (hence why jQuery is a dependency of this gem).<commit_msg>Added some general information to the README.<commit_after># Insulate

*"Page-specific JavaScript".*

Easily partition your JavaScript code based on controller actions. Works great with Rails' asset pipeline default configuration (i.e. all JavaScript concatenated into one huge application.js file).

This gem is a fork of [Paloma](https://github.com/kbparagua/paloma), an excellent and much more comprehensive page-specific JavaScript solution. What does it do differently? Basically, I've just removed a lot of the shiny features and fluff in order to provide something that is extremely simple, compact, and *just works*. Think of it as Paloma Lite.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'insulate'
```

And then execute:

```bash
$ bundle install
```

Lastly, add the following line to the application.js manifest after `//= require jquery` and before `//= require_tree .`:

```
//= require insulate
```

## Usage

It's all very simple. For every controller action that you want to hook into, just add a callback function to a global `Insulate` object. The key must be a string in the format `controller#action`.

CoffeeScript example:

```coffeescript
Insulate['users#new'] = ->
  alert 'Create a new user!'
```

JavaScript example:

```javascript
Insulate['users#edit'] = function() {
  alert('Edit an existing user!');
};
```

Any callback function you define this way will be executed on jQuery's `$(document).ready()` event (hence why jQuery is a dependency of this gem).
{'fraction_non_alphanumeric': 0.10757946210268948, 'fraction_numerical': 0.0, 'mean_word_length': 4.617848970251716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2030816', 'n_tokens_mistral': 705, 'n_tokens_neox': 653, 'n_words': 314}