<commit_before>= Symbolize (attribute values)

This plugin introduces an easy way to use symbols for values of attributes.
Symbolized attributes return a ruby symbol (or nil) as their value
and can be set using :symbols or "strings".

== Install

=== Gem

    gem install symbolize


=== Gemfile

    gem "symbolize"


== About

Just use "symbolize :attribute" in your model, and the specified
attribute will return symbol values and can be set using symbols
(setting string values works, which is important when using forms).

On schema DBs, the attribute should be a string (varchar) column.


== Usage

Gemfile:

    gem 'symbolize', :require => 'symbolize/mongoid'

or

    gem 'symbolize', :require => 'symbolize/active_record'


ActiveRecord:

    class Contact < ActiveRecord::Base

      symbolize :kind, :in => [:im, :mobile, :email], :scopes => true


Mongoid:

    class Contact
      include Mongoid::Symbolize

      symbolize :kind, :in => [:im, :mobile, :email], :scopes => true


Other examples:

    symbolize :so, :in => {
        :linux   => "Linux",
        :mac     => "Mac OS X"
    }, :scopes => true<commit_msg>ops..wrong place<commit_after>= Symbolize (attribute values)

This plugin introduces an easy way to use symbols for values of attributes.
Symbolized attributes return a ruby symbol (or nil) as their value
and can be set using :symbols or "strings".

== Install

=== Gem

    gem install symbolize


=== Gemfile

    gem 'symbolize', :require => 'symbolize/mongoid'

or

    gem 'symbolize', :require => 'symbolize/active_record'


== About

Just use "symbolize :attribute" in your model, and the specified
attribute will return symbol values and can be set using symbols
(setting string values works, which is important when using forms).

On schema DBs, the attribute should be a string (varchar) column.


== Usage


ActiveRecord:

    class Contact < ActiveRecord::Base

      symbolize :kind, :in => [:im, :mobile, :email], :scopes => true


Mongoid:

    class Contact
      include Mongoid::Symbolize

      symbolize :kind, :in => [:im, :mobile, :email], :scopes => true


Other examples:

    symbolize :so, :in => {
        :linux   => "Linux",
        :mac     => "Mac OS X"
    }, :scopes => true
{'fraction_non_alphanumeric': 0.10660124888492417, 'fraction_numerical': 0.0, 'mean_word_length': 3.3723196881091617, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '7264383', 'n_tokens_mistral': 677, 'n_tokens_neox': 640, 'n_words': 269}