<commit_before># has_enum

Gem for Rails 3 app to easily handle enumeration attributes in models.

## Installation and configuration

This gem has been designed for Rails 3 only.

### Install gem

Insert
    gem 'has_enum'
in your Rails 3 Gemfile. Then do
    $ bundle install

## Usage
### Models
Here's example model:
    class TestModel < ActiveRecord::Base
      has_enum :category, %w( stuff things misc )
      has_enum :color   , %w( red green blue )
      has_enum :size    , %w( small medium large )   , :query_methods => false
      has_enum :status  , [:pending, :failed, :done]
    end
See [sample usage in specs](https://github.com/openteam/has_enum/blob/master/spec/has_enum_spec.rb).<commit_msg>README update<commit_after># has_enum

Gem for Rails 3 app to easily handle enumeration attributes in models.

## Installation and configuration

This gem has been designed for Rails 3 only.

### Install gem

Insert
    gem 'has_enum'
in your Rails 3 Gemfile. Then do
    $ bundle install

## Usage
### Models
Here's example model:
    class TestModel < ActiveRecord::Base
      has_enum :category, %w( stuff things misc )
      has_enum :color   , %w( red green blue )
      has_enum :size    , %w( small medium large )   , :query_methods => false
      has_enum :status  , [:pending, :failed, :done]
    end
Query methods are available by default. For example, query methods for color enum this methods will be available:
      color_green?
      color_red?
      color_blue?
See [sample usage in specs](https://github.com/openteam/has_enum/blob/master/spec/has_enum_spec.rb).
{'fraction_non_alphanumeric': 0.0906801007556675, 'fraction_numerical': 0.003778337531486146, 'mean_word_length': 3.389502762430939, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2418828', 'n_tokens_mistral': 495, 'n_tokens_neox': 470, 'n_words': 179}