<commit_before># BsonObjectIdValidations

Provides an ActiveModel validation that checks if an attribute represents a legal BSON::ObjectId .


# Installation

Add this line to your application's Gemfile:

    gem 'bson_object_id_validations'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install bson_object_id_validations


# Usage

Validate that the specified attribute's value is a legal BSON::ObjectId .

```ruby
class User
  include ActiveModel::Validations

  attr_accessor :mongo_id

  validates :mongo_id, :legal_bson_object_id => true
end

user = User.new :mongo_id => "invalid"

user.valid?
=> false

user.errors
=> {:mongo_id=>["is an invalid BSON::ObjectId"]}

user.mongo_id = BSON::ObjectId.new.to_s

user.valid?
=> true
```


# Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to your branch (`git push origin my-new-feature`)
5. Send a pull request
<commit_msg>Update the README.<commit_after># BsonObjectIdValidations

Provides an ActiveModel validation that checks if an attribute represents a legal BSON::ObjectId .


## Installation

Add this line to your application's Gemfile:

    gem 'bson_object_id_validations'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install bson_object_id_validations


## Usage

Validate that the specified attribute's value is a legal BSON::ObjectId .

```ruby
class User
  include ActiveModel::Validations

  attr_accessor :mongo_id

  validates :mongo_id, :legal_bson_object_id => true
end

user = User.new :mongo_id => "invalid"

user.valid?
=> false

user.errors
=> {:mongo_id=>["is an invalid BSON::ObjectId"]}

user.mongo_id = BSON::ObjectId.new.to_s

user.valid?
=> true
```


## Contributing

1. Fork it.
2. Create your feature branch (`git checkout -b my-new-feature`).
3. Commit your changes (`git commit -am 'Added some feature'`).
4. Push to your branch (`git push origin my-new-feature`).
5. Send a pull request.

{'fraction_non_alphanumeric': 0.0984811366976972, 'fraction_numerical': 0.004899559039686428, 'mean_word_length': 4.303896103896104, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, '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': '432509', 'n_tokens_mistral': 695, 'n_tokens_neox': 658, 'n_words': 226}