<commit_before>=== Introduction
Hi there!

=== Features
- State transitions validation.
- State-scoped validations.
- State-scoped lifecycle callbacks (before|after_save, etc)
- ???????
- PROFIT!!!11
As a bonus you get multiple conditions in <tt>:if|:unless => [:one, :two, ...]</tt>
callback and validation options (as in edge Rails).

=== Installation
  gem install pipa-statelogic --source http://gems.github.com

Installable as a plugin too.

=== Bugs & such
http://pipa.lighthouseapp.com/projects/22857-statelogic

=== Example
    class Order < ActiveRecord::Base
      ...
      statelogic do
        # you get methods +unpaid?+ and +was_unpaid?+.
        # may be more than one initial state.
        initial_state 'unpaid' do
          transitions_to 'ready', 'suspended' # won't let you change to wrong states
        end
        state 'ready' do # you get +ready?+, +was_ready?+
          transitions_to 'redeemed', 'suspended'
          validates_presence_of :txref # scoped validations
          before_save :prepare_for_plucking # scoped callbacks
        end
        state 'redeemed' do # likewise
          transitions_to 'suspended'
          validates_presence_of :txref, :redeemed_at, :facility_id # scoped validations
        end
        state 'suspended' do # you guess
          transitions_to 'unpaid', 'ready', 'redeemed'
        end
      end
      ...
    end


Copyright (c) 2009 <NAME>, released under the MIT license<commit_msg>updated readme example<commit_after>=== Introduction
Hi there!

=== Features
- State transitions validation.
- State-scoped validations.
- State-scoped lifecycle callbacks (before|after_save, etc)
- ???????
- PROFIT!!!11
As a bonus you get multiple conditions in <tt>:if|:unless => [:one, :two, ...]</tt>
callback and validation options (as in edge Rails).

=== Installation
  gem install pipa-statelogic --source http://gems.github.com

Installable as a plugin too.

=== Bugs & such
http://pipa.lighthouseapp.com/projects/22857-statelogic

=== Example
    class Order < ActiveRecord::Base
      ...
      statelogic :attribute => :state do # +:state+ is the default value, may be omitted
        # you get methods +unpaid?+ and +was_unpaid?+.
        # may be more than one initial state.
        initial_state 'unpaid' do
          transitions_to 'ready', 'suspended' # won't let you change to wrong states
        end
        state 'ready' do # you get +ready?+, +was_ready?+
          transitions_to 'redeemed', 'suspended'
          validates_presence_of :txref # scoped validations
          before_save :prepare_for_plucking # scoped callbacks
        end
        state 'redeemed' do # likewise
          transitions_to 'suspended'
          validates_presence_of :txref, :redeemed_at, :facility_id # scoped validations
        end
        state 'suspended' do # you guess
          transitions_to 'unpaid', 'ready', 'redeemed'
        end
      end
      ...
    end


Copyright (c) 2009 <NAME>, released under the MIT license
{'fraction_non_alphanumeric': 0.10735785953177257, 'fraction_numerical': 0.007357859531772575, 'mean_word_length': 2.790874524714829, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, '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': '7502115', 'n_tokens_mistral': 923, 'n_tokens_neox': 883, 'n_words': 283}