README.md in affairs_of_state-0.1.4 vs README.md in affairs_of_state-0.2.0

- old
+ new

@@ -1,37 +1,31 @@ # Affairs of State [![Build Status](https://travis-ci.org/kmcphillips/affairs_of_state.png?branch=master)](https://travis-ci.org/kmcphillips/affairs_of_state) -You have an Active Record model. It nees to have multiple states, but not complex rules. This gem gives you validation, easy check and change methods, and a single configuration line. +You have an Active Record model. It nees to have multiple states, boolean convenience methods, simple validation, but not complex rules. This gem gives you this in a single line class method. ## Installation Add this line to your application's Gemfile: ```ruby gem 'affairs_of_state' ``` -And then execute: +Or install it with: ```ruby -$ bundle -``` - -Or install it yourself as: - -```ruby $ gem install affairs_of_state ``` ## Usage The gem assumes you have a string column named `status` on your model: ```ruby -add_column :model_name, :status, :default => "active" +add_column :model_name, :status, default: "active" ``` Then you just list your states in the model: ```ruby @@ -39,17 +33,17 @@ ``` If you'd like to use another column, lets say `state`, pass it in as a configuration option: ```ruby -affairs_of_state :active, :inactive, :column => :state +affairs_of_state :active, :inactive, column: :state ``` You can also turn off validation: ```ruby -affairs_of_state :active, :inactive, :allow_blank => true +affairs_of_state :active, :inactive, allow_blank: true ``` Or give it a long list of statuses: ```ruby @@ -57,14 +51,16 @@ ``` You can also pass a proc or a method name symbol to the :if option to bypass validation: ```ruby -affairs_of_state :active, :inactive, :if => lambda{|object| only_validate_if_this_is_true(object) } -# or -affairs_of_state :active, :inactive, :if => :only_validate_if_this_method_returns_true +affairs_of_state :active, :inactive, if: ->(object) { only_validate_if_this_is_true(object) } ``` +or +```ruby +affairs_of_state :active, :inactive, if: :only_validate_if_this_method_returns_true +``` ## Methods The gem provides methods for checking and setting your status. The question mark method returns a boolean, and the bang method changes to that status. Lets assume you have "active" and "cancelled" as defined status: @@ -112,8 +108,8 @@ ``` ## The usual -Author: Kevin McPhillips - github@kevinmcphillips.ca +By Kevin McPhillips (github@kevinmcphillips.ca) -License: [MIT](http://opensource.org/licenses/MIT) +[MIT License](http://opensource.org/licenses/MIT)