<commit_before># Jacaranda

Generates helper methods based on your model validations creating common methods and scopes.

## Installation

Add this line to your application's Gemfile:

    gem 'jacaranda'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install jacaranda

## Usage

### Basic

Simply add the following line **after the validations**:

    acts_as_jacaranda

like that

    class Post < ActiveRecord::Base
      validates :status, inclusion: { in: %w{published unpublished draft} }
      acts_as_jacaranda
    end

Now your model Post received some powers, we see them.

#### Predicate methods

Ask `@post` if it was published with `@post.published?` or it is a draft with `@post.draft?`.

#### Scopes

Find the posts based on column `status` using the generated scopes like `Post.published` e `Post.draft`.

### Scoped

Perhaps model has 2 validations of inclusion that have valid values repeated

    class Post < ActiveRecord::Base
      validates :status, inclusion: { in: %w{published unpublished draft} }
      validates :kind, inclusion: { in: %w{report unpublished draft} }
      acts_as_jacaranda
    end

in this case use Jacaranda with the param `scoped`:

    acts_as_jacaranda scoped: true

which will generate methods based on column like `#unpublished_status?` and `#unpublished_kind?`.

## Versioning

Jacaranda follow the [Semantic Versioning](http://semver.org/).

## 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 the branch (`git push origin my-new-feature`)
5. Create new Pull Request<commit_msg>added RubyGems badge<commit_after># Jacaranda
[![RubyGems][gem_version_badge]][ruby_gems]

Generates helper methods based on your model validations creating common methods and scopes.

## Installation

Add this line to your application's Gemfile:

    gem 'jacaranda'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install jacaranda

## Usage

### Basic

Simply add the following line **after the validations**:

    acts_as_jacaranda

like that

    class Post < ActiveRecord::Base
      validates :status, inclusion: { in: %w{published unpublished draft} }
      acts_as_jacaranda
    end

Now your model Post received some powers, we see them.

#### Predicate methods

Ask `@post` if it was published with `@post.published?` or it is a draft with `@post.draft?`.

#### Scopes

Find the posts based on column `status` using the generated scopes like `Post.published` e `Post.draft`.

### Scoped

Perhaps model has 2 validations of inclusion that have valid values repeated

    class Post < ActiveRecord::Base
      validates :status, inclusion: { in: %w{published unpublished draft} }
      validates :kind, inclusion: { in: %w{report unpublished draft} }
      acts_as_jacaranda
    end

in this case use Jacaranda with the param `scoped`:

    acts_as_jacaranda scoped: true

which will generate methods based on column like `#unpublished_status?` and `#unpublished_kind?`.

## Versioning

Jacaranda follow the [Semantic Versioning](http://semver.org/).

## 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 the branch (`git push origin my-new-feature`)
5. Create new Pull Request

[gem_version_badge]: https://badge.fury.io/rb/jacaranda.png
[ruby_gems]: http://rubygems.org/gems/jacaranda
{'fraction_non_alphanumeric': 0.09155733029092983, 'fraction_numerical': 0.0034227039361095267, 'mean_word_length': 4.002853067047075, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '6129837', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1027, 'n_words': 412}