github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

mumboe / aasm forked from e12win/aasm

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 2
    • 96
  • Source
  • Commits
  • Network (96)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (4)
    • master ✓
    • multiplesm
    • no_aasm_prefix
    • smobject
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

AASM - State machines for Ruby classes - fork adds support for logging — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Adding logging support 
swalterd (author)
Wed Jun 24 15:36:34 -0700 2009
commit  80365eecb89ea88096929f70df3227f1a204cf84
tree    0bea47a2a6d617a19f278b6cce5d77729344af08
parent  2d87b4b3b1e35fbd47b6bec5374990afa197d9c0
aasm /
name age
history
message
file .gitignore Thu May 29 13:28:06 -0700 2008 add coverage output to gitignore [rubyist]
file CHANGELOG Wed Jun 04 10:02:16 -0700 2008 Add Kevin's change to changelog [rubyist]
file MIT-LICENSE Wed Oct 14 20:07:46 -0700 2009 cleanup, move to jeweler, nuke gemspec [Travis Tilley]
file README.rdoc Wed Jun 24 15:36:34 -0700 2009 Adding logging support [swalterd]
file Rakefile Loading commit data...
file TODO Wed Jun 24 15:36:34 -0700 2009 Adding logging support [swalterd]
file aasm.gemspec Thu May 29 07:16:45 -0700 2008 Updated changelog and version [spicycode]
file aasm.rb Mon Jan 07 11:11:38 -0800 2008 Import into git [rubyist]
directory doc/ Thu Feb 21 08:41:56 -0800 2008 Prepare rakefile and rake tasks for gem packagi... [rubyist]
directory lib/ Wed Jun 24 15:36:34 -0700 2009 Adding logging support [swalterd]
directory spec/ Wed Jun 24 15:36:34 -0700 2009 Adding logging support [swalterd]
README.rdoc

AASM - Ruby state machines

This package contains AASM, a library for adding finite state machines to Ruby classes.

AASM started as the acts_as_state_machine plugin but has evolved into a more generic library that no longer targets only ActiveRecord models.

AASM has the following features:

  • States
          - enter
          - exit
    
  • Machines
  • Events
          - name
          - success -> callback
          - transitions block
    
  • Transitions
          - from
          - to
          - on_transition -> callback
          - guard (returns true or false)
    
  • Callbacks
          - aasm_before_all_transition -> callback before transition begins
          - aasm_after_all_transition -> callback after transition ends
    
  • default and specific log features
          - aasm_log_transition -> instance variable that determines whether to log or not. Defaults to true
          - aasm_log_method -> the method name for common logging name. Defaults to: aasm_log_transition
          - aasm_<event_name>_log -> if you want to have a specific log for one particular event
                                    just implement a method with this naming convention: aasm_<event_name>_log
          - aasm also provided the event name, from state and to state to the instance by populating there instance variables:
                  self.aasm_event_name, self.aasm_old_state, self.aasm_new_state
    
  • transaction if we choose to persist the transition
  • By including AASM, you will have access to these instance methods:
          - <state_name>? -> check if the model is in that state
          - aasm_current_state -> returns the current state of model
          - <event_name>! -> behaves like save!
          - <event_name>  -> behaves like save
          - <event_name>_not_persist -> doesn't save to database
          - aasm_events_for_state -> all events that include the passed state in the from transitions
          - aasm_events_for_current_state -> all events that include the current state in the from transitions
    
  • By including AASM, you will have access to these class methods:
          - aasm_states_for_select -> returns options for all states defined
    

Download

The latest AASM can currently be pulled from the git repository on github.

  • github.com/mumboe/aasm

A release and a gem are forthcoming.

Installation

From GitHub hosted gems

  % sudo gem sources -a http://gems.github.com # (you only need to do this once)
  % sudo gem install mumboe-aasm

Building your own gems

  % rake gem
  % sudo gem install pkg/aasm-0.0.2.gem

Simple Example

Here’s a quick example highlighting some of the features.

  class Conversation
    include AASM

    aasm_initial_state :new

    aasm_state :new
    aasm_state :read
    aasm_state :closed

    aasm_event :view do
      transitions :to => :read, :from => [:new]
    end

    aasm_event :close do
      transitions :to => :closed, :from => [:read, :new]
    end
  end

Other Stuff

Author:Mumboe Development Team, Scott Barron <scott at elitists dot net>
License:Copyright 2009 by Mumboe Copyright 2006, 2007, 2008 by Scott Barron. Released under an MIT-style license. See the LICENSE file included in the distribution.

Warranty

This software is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantibility and fitness for a particular purpose.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server