<commit_before>CodedOptions
============

Just a way to clean up my normal way to deal with coded options.  Basically,
in a Rails controller, it turns

    coded_options :state, %w(initial active closed)

into

    STATES = %w(initial active closed)
    STATE_OPTIONS = [["initial", 0], ["active", 1], ["closed", 2]]
    
    def state
      return unless state_id
      STATES[state_id]
    end

The STATE_OPTIONS array is perfect for select tags.  You can also use this in
a plain Ruby object as follows:

    require "coded_options"

    class Foo
      extend CodedOptions
      attr_accessor :state_id, :type_id
      coded_options :state => %w(active closed), :type => %w(stupid awesome)
    end

    foo = Foo.new
    foo.type_id = 1
    foo.type          #=> awesome

Enjoy!
<commit_msg>upgrading the README a bit<commit_after>CodedOptions
============

Usage
-----

Just a way to clean up my normal way to deal with coded options.  Basically,
in a Rails controller, it turns

    coded_options :state, %w(initial active closed)

into

    STATES = %w(initial active closed)
    STATE_OPTIONS = [["initial", 0], ["active", 1], ["closed", 2]]
    
    def state
      return unless state_id
      STATES[state_id]
    end

The STATE_OPTIONS array is perfect for select tags.  You can also use this in
a plain Ruby object as follows:

    require "coded_options"

    class Foo
      extend CodedOptions
      attr_accessor :state_id, :type_id
      coded_options :state => %w(active closed), :type => %w(stupid awesome)
    end

    foo = Foo.new
    foo.type_id = 1
    foo.type          #=> awesome

Installation
------------

To install into a Rails 3 app just add this to your `Gemfile`:

    gem "coded_options"

and for Rails 2 apps you will want to install it as a plugin:

    ./script/plugin install git://github.com/jasondew/coded_options.git

Enjoy!

{'fraction_non_alphanumeric': 0.10117773019271949, 'fraction_numerical': 0.0053533190578158455, 'mean_word_length': 2.8536082474226805, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5460771', 'n_tokens_mistral': 611, 'n_tokens_neox': 561, 'n_words': 218}