<commit_before># D2E

Utility for converting diff to events.

## Installation

Add this line to your application's Gemfile:

    gem 'd2e'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install d2e

## Usage

```
require 'd2e'
require 'json'

prev = [
  {'id' => 1, 'name' => 'John',   'description' => 'Guitar'},
  {'id' => 2, 'name' => 'Paul',   'description' => 'Bass'},
  {'id' => 3, 'name' => 'George', 'description' => 'Guitar'},
  {'id' => 4, 'name' => 'Ringo',  'description' => 'Drums'},
]
curr = [
  {'id' => 2, 'name' => 'Paul',   'description' => 'Bass/BeatMaking'},
  {'id' => 4, 'name' => 'Ringo',  'description' => 'Drums'},
  {'id' => 5, 'name' => 'Nas',    'description' => 'Rap'},
  {'id' => 6, 'name' => 'Biggie', 'description' => 'Rap'},
]

d2e = D2E.new(key: 'id')
events = d2e.diff(prev, curr)
puts JSON.pretty_generate(events)
```

output:

```
[
  {
    "type": "create",
    "item": {
      "id": 5,
      "name": "Nas",
      "description": "Rap"
    }
  },
  {
    "type": "create",
    "item": {
      "id": 6,
      "name": "Biggie",
      "description": "Rap"
    }
  },
  {
    "type": "delete",
    "item": {
      "id": 1,
      "name": "John",
      "description": "Guitar"
    }
  },
  {
    "type": "delete",
    "item": {
      "id": 3,
      "name": "George",
      "description": "Guitar"
    }
  },
  {
    "type": "update",
    "id": 2,
    "diff": {
      "description": [
        "Bass",
        "Bass/BeatMaking"
      ]
    }
  }
]
```

## Contributing

1. Fork it ( https://github.com/[my-github-username]/d2e/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request<commit_msg>tweak README<commit_after># D2E

Utility for converting diff to events.

## Usage

```
require 'd2e'
require 'json'

prev = [
  {'id' => 1, 'name' => 'John',   'description' => 'Guitar'},
  {'id' => 2, 'name' => 'Paul',   'description' => 'Bass'},
  {'id' => 3, 'name' => 'George', 'description' => 'Guitar'},
  {'id' => 4, 'name' => 'Ringo',  'description' => 'Drums'},
]
curr = [
  {'id' => 2, 'name' => 'Paul',   'description' => 'Bass/BeatMaking'},
  {'id' => 4, 'name' => 'Ringo',  'description' => 'Drums'},
  {'id' => 5, 'name' => 'Nas',    'description' => 'Rap'},
  {'id' => 6, 'name' => 'Biggie', 'description' => 'Rap'},
]

d2e = D2E.new(key: 'id')
events = d2e.diff(prev, curr)
puts JSON.pretty_generate(events)
```

output:

```
[
  {
    "type": "create",
    "item": {
      "id": 5,
      "name": "Nas",
      "description": "Rap"
    }
  },
  {
    "type": "create",
    "item": {
      "id": 6,
      "name": "Biggie",
      "description": "Rap"
    }
  },
  {
    "type": "delete",
    "item": {
      "id": 1,
      "name": "John",
      "description": "Guitar"
    }
  },
  {
    "type": "delete",
    "item": {
      "id": 3,
      "name": "George",
      "description": "Guitar"
    }
  },
  {
    "type": "update",
    "id": 2,
    "diff": {
      "description": [
        "Bass",
        "Bass/BeatMaking"
      ]
    }
  }
]
```

## Installation

Add this line to your application's Gemfile:

    gem 'd2e'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install d2e

## Contributing

1. Fork it ( https://github.com/[my-github-username]/d2e/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
{'fraction_non_alphanumeric': 0.2264567798950566, 'fraction_numerical': 0.01436067384700359, 'mean_word_length': 2.5649606299212597, 'pattern_counts': {'":': 48, '<': 3, '<?xml version=': 0, '>': 51, 'https://': 2, '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': '7261383', 'n_tokens_mistral': 1474, 'n_tokens_neox': 1405, 'n_words': 354}