1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

sdoc generated documentation

This commit is contained in:
Travis Tilley 2009-10-23 16:41:57 -04:00
parent 9ba5bb1f2d
commit 6a330990b5
43 changed files with 6018 additions and 1 deletions

BIN
apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

236
classes/AASM.html Normal file
View file

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
AASM
</h1>
<ul class="files">
<li><a href="../files/lib/aasm/aasm_rb.html">lib/aasm/aasm.rb</a></li>
<li><a href="../files/lib/aasm/event_rb.html">lib/aasm/event.rb</a></li>
<li><a href="../files/lib/aasm/persistence/active_record_persistence_rb.html">lib/aasm/persistence/active_record_persistence.rb</a></li>
<li><a href="../files/lib/aasm/persistence_rb.html">lib/aasm/persistence.rb</a></li>
<li><a href="../files/lib/aasm/state_rb.html">lib/aasm/state.rb</a></li>
<li><a href="../files/lib/aasm/state_machine_rb.html">lib/aasm/state_machine.rb</a></li>
<li><a href="../files/lib/aasm/state_transition_rb.html">lib/aasm/state_transition.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li><a href="#M000011">aasm_current_state</a>,</li>
<li><a href="#M000012">aasm_enter_initial_state</a>,</li>
<li><a href="#M000015">aasm_events_for_current_state</a>,</li>
<li><a href="#M000016">aasm_events_for_state</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="AASM/ClassMethods.html">AASM::ClassMethods</a></li>
<li><span class="type">MODULE</span> <a href="AASM/Persistence.html">AASM::Persistence</a></li>
<li><span class="type">MODULE</span> <a href="AASM/SupportingClasses.html">AASM::SupportingClasses</a></li>
<li><span class="type">CLASS</span> <a href="AASM/InvalidTransition.html">AASM::InvalidTransition</a></li>
<li><span class="type">CLASS</span> <a href="AASM/StateMachine.html">AASM::StateMachine</a></li>
<li><span class="type">CLASS</span> <a href="AASM/UndefinedState.html">AASM::UndefinedState</a></li>
</ul>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000011">
<a name="M000011"></a><b>aasm_current_state</b>()
</div>
<div class="description">
<p>
Instance methods
</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000011_source')" id="l_M000011_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/aasm.rb#L80" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000011_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/aasm.rb, line 80</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_current_state</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@aasm_current_state</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@aasm_current_state</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:aasm_read_state</span>) <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">private_methods</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">'aasm_read_state'</span>)
<span class="ruby-ivar">@aasm_current_state</span> = <span class="ruby-identifier">aasm_read_state</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@aasm_current_state</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@aasm_current_state</span>
<span class="ruby-identifier">aasm_enter_initial_state</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000012">
<a name="M000012"></a><b>aasm_enter_initial_state</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000012_source')" id="l_M000012_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/aasm.rb#L91" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000012_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/aasm.rb, line 91</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_enter_initial_state</span>
<span class="ruby-identifier">state_name</span> = <span class="ruby-identifier">aasm_determine_state_name</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">aasm_initial_state</span>)
<span class="ruby-identifier">state</span> = <span class="ruby-identifier">aasm_state_object_for_state</span>(<span class="ruby-identifier">state_name</span>)
<span class="ruby-identifier">state</span>.<span class="ruby-identifier">call_action</span>(<span class="ruby-identifier">:before_enter</span>, <span class="ruby-keyword kw">self</span>)
<span class="ruby-identifier">state</span>.<span class="ruby-identifier">call_action</span>(<span class="ruby-identifier">:enter</span>, <span class="ruby-keyword kw">self</span>)
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">aasm_current_state</span> = <span class="ruby-identifier">state_name</span>
<span class="ruby-identifier">state</span>.<span class="ruby-identifier">call_action</span>(<span class="ruby-identifier">:after_enter</span>, <span class="ruby-keyword kw">self</span>)
<span class="ruby-identifier">state_name</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000015">
<a name="M000015"></a><b>aasm_events_for_current_state</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000015_source')" id="l_M000015_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/aasm.rb#L103" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000015_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/aasm.rb, line 103</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_events_for_current_state</span>
<span class="ruby-identifier">aasm_events_for_state</span>(<span class="ruby-identifier">aasm_current_state</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000016">
<a name="M000016"></a><b>aasm_events_for_state</b>(state)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000016_source')" id="l_M000016_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/aasm.rb#L107" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000016_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/aasm.rb, line 107</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_events_for_state</span>(<span class="ruby-identifier">state</span>)
<span class="ruby-identifier">events</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">aasm_events</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">event</span><span class="ruby-operator">|</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">transitions_from_state?</span>(<span class="ruby-identifier">state</span>) }
<span class="ruby-identifier">events</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">event</span><span class="ruby-operator">|</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">name</span>}
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,330 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::ClassMethods</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
AASM::ClassMethods
</h1>
<ul class="files">
<li><a href="../../files/lib/aasm/aasm_rb.html">lib/aasm/aasm.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li><a href="#M000005">aasm_event</a>,</li>
<li><a href="#M000007">aasm_events</a>,</li>
<li><a href="#M000002">aasm_initial_state</a>,</li>
<li><a href="#M000003">aasm_initial_state=</a>,</li>
<li><a href="#M000004">aasm_state</a>,</li>
<li><a href="#M000006">aasm_states</a>,</li>
<li><a href="#M000008">aasm_states_for_select</a></li>
</ul>
</dd>
<dt>I</dt>
<dd>
<ul>
<li><a href="#M000001">inherited</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000005">
<a name="M000005"></a><b>aasm_event</b>(name, options = {}, &amp;block)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000005_source')" id="l_M000005_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/aasm.rb#L49" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000005_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/aasm.rb, line 49</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_event</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-identifier">sm</span> = <span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-keyword kw">self</span>]
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">sm</span>.<span class="ruby-identifier">events</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">name</span>)
<span class="ruby-identifier">sm</span>.<span class="ruby-identifier">events</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">SupportingClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">Event</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">define_method</span>(<span class="ruby-node">&quot;#{name.to_s}!&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">aasm_fire_event</span>(<span class="ruby-identifier">name</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">define_method</span>(<span class="ruby-node">&quot;#{name.to_s}&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">aasm_fire_event</span>(<span class="ruby-identifier">name</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000007">
<a name="M000007"></a><b>aasm_events</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000007_source')" id="l_M000007_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/aasm.rb#L69" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000007_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/aasm.rb, line 69</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_events</span>
<span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-keyword kw">self</span>].<span class="ruby-identifier">events</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000002">
<a name="M000002"></a><b>aasm_initial_state</b>(set_state=nil)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000002_source')" id="l_M000002_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/aasm.rb#L27" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000002_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/aasm.rb, line 27</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_initial_state</span>(<span class="ruby-identifier">set_state</span>=<span class="ruby-keyword kw">nil</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">set_state</span>
<span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-keyword kw">self</span>].<span class="ruby-identifier">initial_state</span> = <span class="ruby-identifier">set_state</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-keyword kw">self</span>].<span class="ruby-identifier">initial_state</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000003">
<a name="M000003"></a><b>aasm_initial_state=</b>(state)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000003_source')" id="l_M000003_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/aasm.rb#L35" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000003_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/aasm.rb, line 35</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_initial_state=</span>(<span class="ruby-identifier">state</span>)
<span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-keyword kw">self</span>].<span class="ruby-identifier">initial_state</span> = <span class="ruby-identifier">state</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000004">
<a name="M000004"></a><b>aasm_state</b>(name, options={})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000004_source')" id="l_M000004_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/aasm.rb#L39" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000004_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/aasm.rb, line 39</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_state</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-identifier">sm</span> = <span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-keyword kw">self</span>]
<span class="ruby-identifier">sm</span>.<span class="ruby-identifier">create_state</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-identifier">sm</span>.<span class="ruby-identifier">initial_state</span> = <span class="ruby-identifier">name</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">sm</span>.<span class="ruby-identifier">initial_state</span>
<span class="ruby-identifier">define_method</span>(<span class="ruby-node">&quot;#{name.to_s}?&quot;</span>) <span class="ruby-keyword kw">do</span>
<span class="ruby-identifier">aasm_current_state</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">name</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000006">
<a name="M000006"></a><b>aasm_states</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000006_source')" id="l_M000006_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/aasm.rb#L65" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000006_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/aasm.rb, line 65</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_states</span>
<span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-keyword kw">self</span>].<span class="ruby-identifier">states</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000008">
<a name="M000008"></a><b>aasm_states_for_select</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000008_source')" id="l_M000008_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/aasm.rb#L73" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000008_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/aasm.rb, line 73</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_states_for_select</span>
<span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-keyword kw">self</span>].<span class="ruby-identifier">states</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">state</span><span class="ruby-operator">|</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">for_select</span> }
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000001">
<a name="M000001"></a><b>inherited</b>(klass)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000001_source')" id="l_M000001_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/aasm.rb#L22" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000001_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/aasm.rb, line 22</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inherited</span>(<span class="ruby-identifier">klass</span>)
<span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-identifier">klass</span>] = <span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-keyword kw">self</span>].<span class="ruby-identifier">clone</span>
<span class="ruby-keyword kw">super</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::InvalidTransition</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
AASM::InvalidTransition
<span class="parent">&lt;
RuntimeError
</span>
</h1>
<ul class="files">
<li><a href="../../files/lib/aasm/aasm_rb.html">lib/aasm/aasm.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::Persistence</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
AASM::Persistence
</h1>
<ul class="files">
<li><a href="../../files/lib/aasm/persistence/active_record_persistence_rb.html">lib/aasm/persistence/active_record_persistence.rb</a></li>
<li><a href="../../files/lib/aasm/persistence_rb.html">lib/aasm/persistence.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>S</dt>
<dd>
<ul>
<li><a href="#M000030">set_persistence</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="Persistence/ActiveRecordPersistence.html">AASM::Persistence::ActiveRecordPersistence</a></li>
</ul>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000030">
<a name="M000030"></a><b>set_persistence</b>(base)
</div>
<div class="description">
<p>
Checks to see this class or any of it&#8217;s superclasses inherit from
ActiveRecord::Base and if so includes <a
href="Persistence/ActiveRecordPersistence.html">ActiveRecordPersistence</a>
</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000030_source')" id="l_M000030_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/1e4c038eeec9c6a2a751196a9e36f165e144b721/lib/aasm/persistence.rb#L6" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000030_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/persistence.rb, line 6</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set_persistence</span>(<span class="ruby-identifier">base</span>)
<span class="ruby-comment cmt"># Use a fancier auto-loading thingy, perhaps. When there are more persistence engines.</span>
<span class="ruby-identifier">hierarchy</span> = <span class="ruby-identifier">base</span>.<span class="ruby-identifier">ancestors</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">klass</span><span class="ruby-operator">|</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">to_s</span>}
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hierarchy</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">&quot;ActiveRecord::Base&quot;</span>)
<span class="ruby-identifier">require</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>), <span class="ruby-value str">'persistence'</span>, <span class="ruby-value str">'active_record_persistence'</span>)
<span class="ruby-identifier">base</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:include</span>, <span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">Persistence</span><span class="ruby-operator">::</span><span class="ruby-constant">ActiveRecordPersistence</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,190 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::Persistence::ActiveRecordPersistence</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
AASM::Persistence::ActiveRecordPersistence
</h1>
<ul class="files">
<li><a href="../../../files/lib/aasm/persistence/active_record_persistence_rb.html">lib/aasm/persistence/active_record_persistence.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>I</dt>
<dd>
<ul>
<li><a href="#M000029">included</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="ActiveRecordPersistence/ClassMethods.html">AASM::Persistence::ActiveRecordPersistence::ClassMethods</a></li>
<li><span class="type">MODULE</span> <a href="ActiveRecordPersistence/InstanceMethods.html">AASM::Persistence::ActiveRecordPersistence::InstanceMethods</a></li>
<li><span class="type">MODULE</span> <a href="ActiveRecordPersistence/NamedScopeMethods.html">AASM::Persistence::ActiveRecordPersistence::NamedScopeMethods</a></li>
<li><span class="type">MODULE</span> <a href="ActiveRecordPersistence/ReadState.html">AASM::Persistence::ActiveRecordPersistence::ReadState</a></li>
<li><span class="type">MODULE</span> <a href="ActiveRecordPersistence/WriteState.html">AASM::Persistence::ActiveRecordPersistence::WriteState</a></li>
<li><span class="type">MODULE</span> <a href="ActiveRecordPersistence/WriteStateWithoutPersistence.html">AASM::Persistence::ActiveRecordPersistence::WriteStateWithoutPersistence</a></li>
</ul>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000029">
<a name="M000029"></a><b>included</b>(base)
</div>
<div class="description">
<p>
This method:
</p>
<ul>
<li>extends the model with <a
href="ActiveRecordPersistence/ClassMethods.html">ClassMethods</a>
</li>
<li>includes <a
href="ActiveRecordPersistence/InstanceMethods.html">InstanceMethods</a>
</li>
</ul>
<p>
Unless the corresponding methods are already defined, it includes
</p>
<ul>
<li><a href="ActiveRecordPersistence/ReadState.html">ReadState</a>
</li>
<li><a href="ActiveRecordPersistence/WriteState.html">WriteState</a>
</li>
<li><a
href="ActiveRecordPersistence/WriteStateWithoutPersistence.html">WriteStateWithoutPersistence</a>
</li>
</ul>
<p>
Adds
</p>
<pre>
before_validation_on_create :aasm_ensure_initial_state
</pre>
<p>
As a result, it doesn&#8217;t matter when you define your methods - the
following 2 are equivalent
</p>
<pre>
class Foo &lt; ActiveRecord::Base
def aasm_write_state(state)
&quot;bar&quot;
end
include AASM
end
class Foo &lt; ActiveRecord::Base
include AASM
def aasm_write_state(state)
&quot;bar&quot;
end
end
</pre>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000029_source')" id="l_M000029_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/e97a93089705ca55c8ac9c59afb8b75695f0c5cc/lib/aasm/persistence/active_record_persistence.rb#L34" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000029_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/persistence/active_record_persistence.rb, line 34</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
<span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">Persistence</span><span class="ruby-operator">::</span><span class="ruby-constant">ActiveRecordPersistence</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassMethods</span>
<span class="ruby-identifier">base</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:include</span>, <span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">Persistence</span><span class="ruby-operator">::</span><span class="ruby-constant">ActiveRecordPersistence</span><span class="ruby-operator">::</span><span class="ruby-constant">InstanceMethods</span>)
<span class="ruby-identifier">base</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:include</span>, <span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">Persistence</span><span class="ruby-operator">::</span><span class="ruby-constant">ActiveRecordPersistence</span><span class="ruby-operator">::</span><span class="ruby-constant">ReadState</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">base</span>.<span class="ruby-identifier">method_defined?</span>(<span class="ruby-identifier">:aasm_read_state</span>)
<span class="ruby-identifier">base</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:include</span>, <span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">Persistence</span><span class="ruby-operator">::</span><span class="ruby-constant">ActiveRecordPersistence</span><span class="ruby-operator">::</span><span class="ruby-constant">WriteState</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">base</span>.<span class="ruby-identifier">method_defined?</span>(<span class="ruby-identifier">:aasm_write_state</span>)
<span class="ruby-identifier">base</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:include</span>, <span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">Persistence</span><span class="ruby-operator">::</span><span class="ruby-constant">ActiveRecordPersistence</span><span class="ruby-operator">::</span><span class="ruby-constant">WriteStateWithoutPersistence</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">base</span>.<span class="ruby-identifier">method_defined?</span>(<span class="ruby-identifier">:aasm_write_state_without_persistence</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:named_scope</span>)
<span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">Persistence</span><span class="ruby-operator">::</span><span class="ruby-constant">ActiveRecordPersistence</span><span class="ruby-operator">::</span><span class="ruby-constant">NamedScopeMethods</span>)
<span class="ruby-identifier">base</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
<span class="ruby-keyword kw">class</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">method_defined?</span>(<span class="ruby-identifier">:aasm_state_without_named_scope</span>)
<span class="ruby-identifier">alias_method</span> <span class="ruby-identifier">:aasm_state_without_named_scope</span>, <span class="ruby-identifier">:aasm_state</span>
<span class="ruby-identifier">alias_method</span> <span class="ruby-identifier">:aasm_state</span>, <span class="ruby-identifier">:aasm_state_with_named_scope</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">base</span>.<span class="ruby-identifier">before_validation_on_create</span> <span class="ruby-identifier">:aasm_ensure_initial_state</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,287 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::Persistence::ActiveRecordPersistence::ClassMethods</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
AASM::Persistence::ActiveRecordPersistence::ClassMethods
</h1>
<ul class="files">
<li><a href="../../../../files/lib/aasm/persistence/active_record_persistence_rb.html">lib/aasm/persistence/active_record_persistence.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li><a href="#M000031">aasm_column</a></li>
</ul>
</dd>
<dt>C</dt>
<dd>
<ul>
<li><a href="#M000034">calculate_in_state</a>,</li>
<li><a href="#M000033">count_in_state</a></li>
</ul>
</dd>
<dt>F</dt>
<dd>
<ul>
<li><a href="#M000032">find_in_state</a></li>
</ul>
</dd>
<dt>W</dt>
<dd>
<ul>
<li><a href="#M000035">with_state_scope</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000031">
<a name="M000031"></a><b>aasm_column</b>(column_name=nil)
</div>
<div class="description">
<p>
Maps to the <a href="ClassMethods.html#M000031">aasm_column</a> in the
database. Deafults to &#8220;aasm_state&#8220;. You can write:
</p>
<pre>
create_table :foos do |t|
t.string :name
t.string :aasm_state
end
class Foo &lt; ActiveRecord::Base
include AASM
end
</pre>
<p>
OR:
</p>
<pre>
create_table :foos do |t|
t.string :name
t.string :status
end
class Foo &lt; ActiveRecord::Base
include AASM
aasm_column :status
end
</pre>
<p>
This method is both a getter and a setter
</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000031_source')" id="l_M000031_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/e97a93089705ca55c8ac9c59afb8b75695f0c5cc/lib/aasm/persistence/active_record_persistence.rb#L82" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000031_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/persistence/active_record_persistence.rb, line 82</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_column</span>(<span class="ruby-identifier">column_name</span>=<span class="ruby-keyword kw">nil</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">column_name</span>
<span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-keyword kw">self</span>].<span class="ruby-identifier">config</span>.<span class="ruby-identifier">column</span> = <span class="ruby-identifier">column_name</span>.<span class="ruby-identifier">to_sym</span>
<span class="ruby-comment cmt"># @aasm_column = column_name.to_sym</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-keyword kw">self</span>].<span class="ruby-identifier">config</span>.<span class="ruby-identifier">column</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">:aasm_state</span>
<span class="ruby-comment cmt"># @aasm_column ||= :aasm_state</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-comment cmt"># @aasm_column</span>
<span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">StateMachine</span>[<span class="ruby-keyword kw">self</span>].<span class="ruby-identifier">config</span>.<span class="ruby-identifier">column</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000034">
<a name="M000034"></a><b>calculate_in_state</b>(state, *args)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000034_source')" id="l_M000034_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/e97a93089705ca55c8ac9c59afb8b75695f0c5cc/lib/aasm/persistence/active_record_persistence.rb#L106" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000034_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/persistence/active_record_persistence.rb, line 106</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">calculate_in_state</span>(<span class="ruby-identifier">state</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-identifier">with_state_scope</span> <span class="ruby-identifier">state</span> <span class="ruby-keyword kw">do</span>
<span class="ruby-identifier">calculate</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000033">
<a name="M000033"></a><b>count_in_state</b>(state, *args)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000033_source')" id="l_M000033_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/e97a93089705ca55c8ac9c59afb8b75695f0c5cc/lib/aasm/persistence/active_record_persistence.rb#L100" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000033_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/persistence/active_record_persistence.rb, line 100</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">count_in_state</span>(<span class="ruby-identifier">state</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-identifier">with_state_scope</span> <span class="ruby-identifier">state</span> <span class="ruby-keyword kw">do</span>
<span class="ruby-identifier">count</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000032">
<a name="M000032"></a><b>find_in_state</b>(number, state, *args)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000032_source')" id="l_M000032_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/e97a93089705ca55c8ac9c59afb8b75695f0c5cc/lib/aasm/persistence/active_record_persistence.rb#L94" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000032_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/persistence/active_record_persistence.rb, line 94</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_in_state</span>(<span class="ruby-identifier">number</span>, <span class="ruby-identifier">state</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-identifier">with_state_scope</span> <span class="ruby-identifier">state</span> <span class="ruby-keyword kw">do</span>
<span class="ruby-identifier">find</span>(<span class="ruby-identifier">number</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Protected methods</div>
<div class="method">
<div class="title" id="M000035">
<a name="M000035"></a><b>with_state_scope</b>(state)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000035_source')" id="l_M000035_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/e97a93089705ca55c8ac9c59afb8b75695f0c5cc/lib/aasm/persistence/active_record_persistence.rb#L113" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000035_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/persistence/active_record_persistence.rb, line 113</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with_state_scope</span>(<span class="ruby-identifier">state</span>)
<span class="ruby-identifier">with_scope</span> <span class="ruby-identifier">:find</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-node">&quot;#{table_name}.#{aasm_column} = ?&quot;</span>, <span class="ruby-identifier">state</span>.<span class="ruby-identifier">to_s</span>]} <span class="ruby-keyword kw">do</span>
<span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::Persistence::ActiveRecordPersistence::InstanceMethods</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
AASM::Persistence::ActiveRecordPersistence::InstanceMethods
</h1>
<ul class="files">
<li><a href="../../../../files/lib/aasm/persistence/active_record_persistence_rb.html">lib/aasm/persistence/active_record_persistence.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li><a href="#M000037">aasm_current_state</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000037">
<a name="M000037"></a><b>aasm_current_state</b>()
</div>
<div class="description">
<p>
Returns the current aasm_state of the object. Respects reload and any
changes made to the aasm_state field directly
</p>
<p>
Internally just calls <tt>aasm_read_state</tt>
</p>
<pre>
foo = Foo.find(1)
foo.aasm_current_state # =&gt; :pending
foo.aasm_state = &quot;opened&quot;
foo.aasm_current_state # =&gt; :opened
foo.close # =&gt; calls aasm_write_state_without_persistence
foo.aasm_current_state # =&gt; :closed
foo.reload
foo.aasm_current_state # =&gt; :pending
</pre>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000037_source')" id="l_M000037_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/e97a93089705ca55c8ac9c59afb8b75695f0c5cc/lib/aasm/persistence/active_record_persistence.rb#L136" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000037_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/persistence/active_record_persistence.rb, line 136</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_current_state</span>
<span class="ruby-ivar">@current_state</span> = <span class="ruby-identifier">aasm_read_state</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::Persistence::ActiveRecordPersistence::NamedScopeMethods</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
AASM::Persistence::ActiveRecordPersistence::NamedScopeMethods
</h1>
<ul class="files">
<li><a href="../../../../files/lib/aasm/persistence/active_record_persistence_rb.html">lib/aasm/persistence/active_record_persistence.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li><a href="#M000048">aasm_state_with_named_scope</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000048">
<a name="M000048"></a><b>aasm_state_with_named_scope</b>(name, options = {})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000048_source')" id="l_M000048_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/e97a93089705ca55c8ac9c59afb8b75695f0c5cc/lib/aasm/persistence/active_record_persistence.rb#L241" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000048_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/persistence/active_record_persistence.rb, line 241</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_state_with_named_scope</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {}
<span class="ruby-identifier">aasm_state_without_named_scope</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">named_scope</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> { <span class="ruby-node">&quot;#{table_name}.#{self.aasm_column}&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>} <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">name</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::Persistence::ActiveRecordPersistence::ReadState</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
AASM::Persistence::ActiveRecordPersistence::ReadState
</h1>
<ul class="files">
<li><a href="../../../../files/lib/aasm/persistence/active_record_persistence_rb.html">lib/aasm/persistence/active_record_persistence.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li><a href="#M000047">aasm_read_state</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000047">
<a name="M000047"></a><b>aasm_read_state</b>()
</div>
<div class="description">
<p>
Returns the value of the aasm_column - called from
<tt>aasm_current_state</tt>
</p>
<p>
If it&#8217;s a new record, and the aasm state column is blank it returns
the initial state:
</p>
<pre>
class Foo &lt; ActiveRecord::Base
include AASM
aasm_column :status
aasm_state :opened
aasm_state :closed
end
foo = Foo.new
foo.current_state # =&gt; :opened
foo.close
foo.current_state # =&gt; :closed
foo = Foo.find(1)
foo.current_state # =&gt; :opened
foo.aasm_state = nil
foo.current_state # =&gt; nil
</pre>
<p>
NOTE: intended to be called from an event
</p>
<p>
This allows for nil aasm states - be sure to add validation to your model
</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000047_source')" id="l_M000047_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/e97a93089705ca55c8ac9c59afb8b75695f0c5cc/lib/aasm/persistence/active_record_persistence.rb#L231" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000047_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/persistence/active_record_persistence.rb, line 231</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_read_state</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">new_record?</span>
<span class="ruby-identifier">send</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">aasm_column</span>).<span class="ruby-identifier">blank?</span> <span class="ruby-value">? </span><span class="ruby-identifier">aasm_determine_state_name</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">aasm_initial_state</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">send</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">aasm_column</span>).<span class="ruby-identifier">to_sym</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">send</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">aasm_column</span>).<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">send</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">aasm_column</span>).<span class="ruby-identifier">to_sym</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::Persistence::ActiveRecordPersistence::WriteState</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
AASM::Persistence::ActiveRecordPersistence::WriteState
</h1>
<ul class="files">
<li><a href="../../../../files/lib/aasm/persistence/active_record_persistence_rb.html">lib/aasm/persistence/active_record_persistence.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li><a href="#M000044">aasm_write_state</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000044">
<a name="M000044"></a><b>aasm_write_state</b>(state)
</div>
<div class="description">
<p>
Writes <tt>state</tt> to the state column and persists it to the database
using update_attribute (which bypasses validation)
</p>
<pre>
foo = Foo.find(1)
foo.aasm_current_state # =&gt; :opened
foo.close!
foo.aasm_current_state # =&gt; :closed
Foo.find(1).aasm_current_state # =&gt; :closed
</pre>
<p>
NOTE: intended to be called from an event
</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000044_source')" id="l_M000044_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/e97a93089705ca55c8ac9c59afb8b75695f0c5cc/lib/aasm/persistence/active_record_persistence.rb#L192" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000044_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/persistence/active_record_persistence.rb, line 192</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_write_state</span>(<span class="ruby-identifier">state</span>)
<span class="ruby-identifier">old_value</span> = <span class="ruby-identifier">read_attribute</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">aasm_column</span>)
<span class="ruby-identifier">write_attribute</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">aasm_column</span>, <span class="ruby-identifier">state</span>.<span class="ruby-identifier">to_s</span>)
<span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">save</span>(<span class="ruby-keyword kw">false</span>)
<span class="ruby-identifier">write_attribute</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">aasm_column</span>, <span class="ruby-identifier">old_value</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">true</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::Persistence::ActiveRecordPersistence::WriteStateWithoutPersistence</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
AASM::Persistence::ActiveRecordPersistence::WriteStateWithoutPersistence
</h1>
<ul class="files">
<li><a href="../../../../files/lib/aasm/persistence/active_record_persistence_rb.html">lib/aasm/persistence/active_record_persistence.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>A</dt>
<dd>
<ul>
<li><a href="#M000043">aasm_write_state_without_persistence</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000043">
<a name="M000043"></a><b>aasm_write_state_without_persistence</b>(state)
</div>
<div class="description">
<p>
Writes <tt>state</tt> to the state column, but does not persist it to the
database
</p>
<pre>
foo = Foo.find(1)
foo.aasm_current_state # =&gt; :opened
foo.close
foo.aasm_current_state # =&gt; :closed
Foo.find(1).aasm_current_state # =&gt; :opened
foo.save
foo.aasm_current_state # =&gt; :closed
Foo.find(1).aasm_current_state # =&gt; :closed
</pre>
<p>
NOTE: intended to be called from an event
</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000043_source')" id="l_M000043_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/e97a93089705ca55c8ac9c59afb8b75695f0c5cc/lib/aasm/persistence/active_record_persistence.rb#L176" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000043_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/persistence/active_record_persistence.rb, line 176</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aasm_write_state_without_persistence</span>(<span class="ruby-identifier">state</span>)
<span class="ruby-identifier">write_attribute</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">aasm_column</span>, <span class="ruby-identifier">state</span>.<span class="ruby-identifier">to_s</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,288 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::StateMachine</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
AASM::StateMachine
<span class="parent">&lt;
Object
</span>
</h1>
<ul class="files">
<li><a href="../../files/lib/aasm/state_machine_rb.html">lib/aasm/state_machine.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>#</dt>
<dd>
<ul>
<li><a href="#M000049">[]</a>,</li>
<li><a href="#M000050">[]=</a></li>
</ul>
</dd>
<dt>C</dt>
<dd>
<ul>
<li><a href="#M000052">clone</a>,</li>
<li><a href="#M000053">create_state</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000051">new</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Attributes</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>states</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>events</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>initial_state</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[RW]
</td>
<td class='attr-name'>config</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>name</td>
<td class='attr-desc'></td>
</tr>
</table>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000049">
<a name="M000049"></a><b>[]</b>(*args)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000049_source')" id="l_M000049_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state_machine.rb#L5" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000049_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state_machine.rb, line 5</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-operator">[]</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
(<span class="ruby-ivar">@machines</span> <span class="ruby-operator">||=</span> {})[<span class="ruby-identifier">args</span>]
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000050">
<a name="M000050"></a><b>[]=</b>(*args)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000050_source')" id="l_M000050_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state_machine.rb#L9" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000050_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state_machine.rb, line 9</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-operator">[]=</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">pop</span>
(<span class="ruby-ivar">@machines</span> <span class="ruby-operator">||=</span> {})[<span class="ruby-identifier">args</span>] = <span class="ruby-identifier">val</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000051">
<a name="M000051"></a><b>new</b>(name)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000051_source')" id="l_M000051_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state_machine.rb#L17" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000051_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state_machine.rb, line 17</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>)
<span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
<span class="ruby-ivar">@initial_state</span> = <span class="ruby-keyword kw">nil</span>
<span class="ruby-ivar">@states</span> = []
<span class="ruby-ivar">@events</span> = {}
<span class="ruby-ivar">@config</span> = <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000052">
<a name="M000052"></a><b>clone</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000052_source')" id="l_M000052_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state_machine.rb#L25" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000052_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state_machine.rb, line 25</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clone</span>
<span class="ruby-identifier">klone</span> = <span class="ruby-keyword kw">super</span>
<span class="ruby-identifier">klone</span>.<span class="ruby-identifier">states</span> = <span class="ruby-identifier">states</span>.<span class="ruby-identifier">clone</span>
<span class="ruby-identifier">klone</span>.<span class="ruby-identifier">events</span> = <span class="ruby-identifier">events</span>.<span class="ruby-identifier">clone</span>
<span class="ruby-identifier">klone</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000053">
<a name="M000053"></a><b>create_state</b>(name, options)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000053_source')" id="l_M000053_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state_machine.rb#L32" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000053_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state_machine.rb, line 32</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_state</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-ivar">@states</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">SupportingClasses</span><span class="ruby-operator">::</span><span class="ruby-constant">State</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@states</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">name</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::SupportingClasses</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
AASM::SupportingClasses
</h1>
<ul class="files">
<li><a href="../../files/lib/aasm/event_rb.html">lib/aasm/event.rb</a></li>
<li><a href="../../files/lib/aasm/state_rb.html">lib/aasm/state.rb</a></li>
<li><a href="../../files/lib/aasm/state_transition_rb.html">lib/aasm/state_transition.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">CLASS</span> <a href="SupportingClasses/Event.html">AASM::SupportingClasses::Event</a></li>
<li><span class="type">CLASS</span> <a href="SupportingClasses/State.html">AASM::SupportingClasses::State</a></li>
<li><span class="type">CLASS</span> <a href="SupportingClasses/StateTransition.html">AASM::SupportingClasses::StateTransition</a></li>
</ul>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,451 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::SupportingClasses::Event</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
AASM::SupportingClasses::Event
<span class="parent">&lt;
Object
</span>
</h1>
<ul class="files">
<li><a href="../../../files/lib/aasm/event_rb.html">lib/aasm/event.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>#</dt>
<dd>
<ul>
<li><a href="#M000020">==</a></li>
</ul>
</dd>
<dt>A</dt>
<dd>
<ul>
<li><a href="#M000018">all_transitions</a></li>
</ul>
</dd>
<dt>C</dt>
<dd>
<ul>
<li><a href="#M000019">call_action</a></li>
</ul>
</dd>
<dt>E</dt>
<dd>
<ul>
<li><a href="#M000025">execute_success_callback</a></li>
</ul>
</dd>
<dt>F</dt>
<dd>
<ul>
<li><a href="#M000010">fire</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000009">new</a></li>
</ul>
</dd>
<dt>T</dt>
<dd>
<ul>
<li><a href="#M000014">transitions_from_state</a>,</li>
<li><a href="#M000013">transitions_from_state?</a></li>
</ul>
</dd>
<dt>U</dt>
<dd>
<ul>
<li><a href="#M000021">update</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Attributes</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>name</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>success</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>options</td>
<td class='attr-desc'></td>
</tr>
</table>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000009">
<a name="M000009"></a><b>new</b>(name, options = {}, &amp;block)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000009_source')" id="l_M000009_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/event.rb#L8" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000009_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/event.rb, line 8</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
<span class="ruby-ivar">@transitions</span> = []
<span class="ruby-identifier">update</span>(<span class="ruby-identifier">options</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000020">
<a name="M000020"></a><b>==</b>(event)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000020_source')" id="l_M000020_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/event.rb#L49" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000020_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/event.rb, line 49</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">event</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Symbol</span>
<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">event</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">name</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000018">
<a name="M000018"></a><b>all_transitions</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000018_source')" id="l_M000018_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/event.rb#L38" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000018_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/event.rb, line 38</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all_transitions</span>
<span class="ruby-ivar">@transitions</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000019">
<a name="M000019"></a><b>call_action</b>(action, record)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000019_source')" id="l_M000019_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/event.rb#L42" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000019_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/event.rb, line 42</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">record</span>)
<span class="ruby-identifier">action</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">action</span>]
<span class="ruby-identifier">action</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">?</span>
<span class="ruby-identifier">action</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">_call_action</span>(<span class="ruby-identifier">a</span>, <span class="ruby-identifier">record</span>)} <span class="ruby-operator">:</span>
<span class="ruby-identifier">_call_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">record</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000025">
<a name="M000025"></a><b>execute_success_callback</b>(obj, success = nil)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000025_source')" id="l_M000025_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/event.rb#L68" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000025_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/event.rb, line 68</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">execute_success_callback</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">success</span> = <span class="ruby-keyword kw">nil</span>)
<span class="ruby-identifier">callback</span> = <span class="ruby-identifier">success</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@success</span>
<span class="ruby-keyword kw">case</span>(<span class="ruby-identifier">callback</span>)
<span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>, <span class="ruby-constant">Symbol</span>
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">callback</span>)
<span class="ruby-keyword kw">when</span> <span class="ruby-constant">Proc</span>
<span class="ruby-identifier">callback</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">obj</span>)
<span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span>
<span class="ruby-identifier">callback</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">meth</span><span class="ruby-operator">|</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">execute_success_callback</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">meth</span>)}
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000010">
<a name="M000010"></a><b>fire</b>(obj, to_state=nil, *args)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000010_source')" id="l_M000010_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/event.rb#L14" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000010_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/event.rb, line 14</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fire</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">to_state</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-identifier">transitions</span> = <span class="ruby-ivar">@transitions</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">from</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">aasm_current_state</span> }
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AASM</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidTransition</span>, <span class="ruby-node">&quot;Event '#{name}' cannot transition from '#{obj.aasm_current_state}'&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">transitions</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
<span class="ruby-identifier">next_state</span> = <span class="ruby-keyword kw">nil</span>
<span class="ruby-identifier">transitions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">transition</span><span class="ruby-operator">|</span>
<span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">to_state</span> <span class="ruby-keyword kw">and</span> <span class="ruby-operator">!</span><span class="ruby-constant">Array</span>(<span class="ruby-identifier">transition</span>.<span class="ruby-identifier">to</span>).<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">to_state</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">transition</span>.<span class="ruby-identifier">perform</span>(<span class="ruby-identifier">obj</span>)
<span class="ruby-identifier">next_state</span> = <span class="ruby-identifier">to_state</span> <span class="ruby-operator">||</span> <span class="ruby-constant">Array</span>(<span class="ruby-identifier">transition</span>.<span class="ruby-identifier">to</span>).<span class="ruby-identifier">first</span>
<span class="ruby-identifier">transition</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-keyword kw">break</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">next_state</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000014">
<a name="M000014"></a><b>transitions_from_state</b>(state)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000014_source')" id="l_M000014_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/event.rb#L34" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000014_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/event.rb, line 34</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">transitions_from_state</span>(<span class="ruby-identifier">state</span>)
<span class="ruby-ivar">@transitions</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">from</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">state</span> }
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000013">
<a name="M000013"></a><b>transitions_from_state?</b>(state)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000013_source')" id="l_M000013_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/event.rb#L30" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000013_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/event.rb, line 30</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">transitions_from_state?</span>(<span class="ruby-identifier">state</span>)
<span class="ruby-ivar">@transitions</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">from</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">state</span> }
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000021">
<a name="M000021"></a><b>update</b>(options = {}, &amp;block)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000021_source')" id="l_M000021_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/event.rb#L57" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000021_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/event.rb, line 57</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">:success</span>) <span class="ruby-keyword kw">then</span>
<span class="ruby-ivar">@success</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:success</span>]
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span> <span class="ruby-keyword kw">then</span>
<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
<span class="ruby-keyword kw">self</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,318 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::SupportingClasses::State</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
AASM::SupportingClasses::State
<span class="parent">&lt;
Object
</span>
</h1>
<ul class="files">
<li><a href="../../../files/lib/aasm/state_rb.html">lib/aasm/state.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>#</dt>
<dd>
<ul>
<li><a href="#M000039">==</a></li>
</ul>
</dd>
<dt>C</dt>
<dd>
<ul>
<li><a href="#M000040">call_action</a></li>
</ul>
</dd>
<dt>D</dt>
<dd>
<ul>
<li><a href="#M000041">display_name</a></li>
</ul>
</dd>
<dt>F</dt>
<dd>
<ul>
<li><a href="#M000042">for_select</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000036">new</a></li>
</ul>
</dd>
<dt>U</dt>
<dd>
<ul>
<li><a href="#M000045">update</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Attributes</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>name</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>options</td>
<td class='attr-desc'></td>
</tr>
</table>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000036">
<a name="M000036"></a><b>new</b>(name, options={})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000036_source')" id="l_M000036_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state.rb#L6" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000036_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state.rb, line 6</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
<span class="ruby-identifier">update</span>(<span class="ruby-identifier">options</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000039">
<a name="M000039"></a><b>==</b>(state)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000039_source')" id="l_M000039_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state.rb#L11" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000039_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state.rb, line 11</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">state</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Symbol</span>
<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">state</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">name</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000040">
<a name="M000040"></a><b>call_action</b>(action, record)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000040_source')" id="l_M000040_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state.rb#L19" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000040_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state.rb, line 19</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">record</span>)
<span class="ruby-identifier">action</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">action</span>]
<span class="ruby-identifier">action</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">?</span>
<span class="ruby-identifier">action</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">_call_action</span>(<span class="ruby-identifier">a</span>, <span class="ruby-identifier">record</span>)} <span class="ruby-operator">:</span>
<span class="ruby-identifier">_call_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">record</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000041">
<a name="M000041"></a><b>display_name</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000041_source')" id="l_M000041_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state.rb#L26" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000041_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state.rb, line 26</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">display_name</span>
<span class="ruby-ivar">@display_name</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/_/</span>, <span class="ruby-value str">' '</span>).<span class="ruby-identifier">capitalize</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000042">
<a name="M000042"></a><b>for_select</b>()
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000042_source')" id="l_M000042_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state.rb#L30" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000042_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state.rb, line 30</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">for_select</span>
[<span class="ruby-identifier">display_name</span>, <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>]
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000045">
<a name="M000045"></a><b>update</b>(options = {})
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000045_source')" id="l_M000045_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state.rb#L34" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000045_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state.rb, line 34</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">options</span> = {})
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">:display</span>) <span class="ruby-keyword kw">then</span>
<span class="ruby-ivar">@display_name</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:display</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
<span class="ruby-keyword kw">self</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,288 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::SupportingClasses::StateTransition</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
AASM::SupportingClasses::StateTransition
<span class="parent">&lt;
Object
</span>
</h1>
<ul class="files">
<li><a href="../../../files/lib/aasm/state_transition_rb.html">lib/aasm/state_transition.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>#</dt>
<dd>
<ul>
<li><a href="#M000057">==</a></li>
</ul>
</dd>
<dt>E</dt>
<dd>
<ul>
<li><a href="#M000056">execute</a></li>
</ul>
</dd>
<dt>F</dt>
<dd>
<ul>
<li><a href="#M000058">from?</a></li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li><a href="#M000054">new</a></li>
</ul>
</dd>
<dt>P</dt>
<dd>
<ul>
<li><a href="#M000055">perform</a></li>
</ul>
</dd>
</dl>
<div class="sectiontitle">Attributes</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>from</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>to</td>
<td class='attr-desc'></td>
</tr>
<tr valign='top'>
<td class='attr-rw'>
[R]
</td>
<td class='attr-name'>opts</td>
<td class='attr-desc'></td>
</tr>
</table>
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title" id="M000054">
<a name="M000054"></a><b>new</b>(opts)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000054_source')" id="l_M000054_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state_transition.rb#L7" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000054_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state_transition.rb, line 7</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">opts</span>)
<span class="ruby-ivar">@from</span>, <span class="ruby-ivar">@to</span>, <span class="ruby-ivar">@guard</span>, <span class="ruby-ivar">@on_transition</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:from</span>], <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:to</span>], <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:guard</span>], <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:on_transition</span>]
<span class="ruby-ivar">@opts</span> = <span class="ruby-identifier">opts</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title" id="M000057">
<a name="M000057"></a><b>==</b>(obj)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000057_source')" id="l_M000057_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state_transition.rb#L29" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000057_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state_transition.rb, line 29</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">obj</span>)
<span class="ruby-ivar">@from</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">from</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@to</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">to</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000056">
<a name="M000056"></a><b>execute</b>(obj, *args)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000056_source')" id="l_M000056_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state_transition.rb#L23" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000056_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state_transition.rb, line 23</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-ivar">@on_transition</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">?</span>
<span class="ruby-ivar">@on_transition</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ot</span><span class="ruby-operator">|</span> <span class="ruby-identifier">_execute</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">ot</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)} <span class="ruby-operator">:</span>
<span class="ruby-identifier">_execute</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-ivar">@on_transition</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000058">
<a name="M000058"></a><b>from?</b>(value)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000058_source')" id="l_M000058_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state_transition.rb#L33" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000058_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state_transition.rb, line 33</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from?</span>(<span class="ruby-identifier">value</span>)
<span class="ruby-ivar">@from</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">value</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title" id="M000055">
<a name="M000055"></a><b>perform</b>(obj)
</div>
<div class="sourcecode">
<p class="source-link">
Source: <a href="javascript:toggleSource('M000055_source')" id="l_M000055_source">show</a>
| <a href="http://github.com/rubyist/aasm/blob/dc002d4684a481fed59c88b4916f7b0c29354d96/lib/aasm/state_transition.rb#L12" target="_blank" class="github_url">on GitHub</a>
</p>
<div id="M000055_source" class="dyn-source">
<pre><span class="ruby-comment cmt"># File lib/aasm/state_transition.rb, line 12</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">perform</span>(<span class="ruby-identifier">obj</span>)
<span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@guard</span>
<span class="ruby-keyword kw">when</span> <span class="ruby-constant">Symbol</span>, <span class="ruby-constant">String</span>
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">send</span>(<span class="ruby-ivar">@guard</span>)
<span class="ruby-keyword kw">when</span> <span class="ruby-constant">Proc</span>
<span class="ruby-ivar">@guard</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">obj</span>)
<span class="ruby-keyword kw">else</span>
<span class="ruby-keyword kw">true</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AASM::UndefinedState</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Class</span>
AASM::UndefinedState
<span class="parent">&lt;
RuntimeError
</span>
</h1>
<ul class="files">
<li><a href="../../files/lib/aasm/aasm_rb.html">lib/aasm/aasm.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
</div>
</div>
</body>
</html>

1
created.rid Normal file
View file

@ -0,0 +1 @@
Fri, 23 Oct 2009 16:40:51 -0400

263
css/main.css Executable file
View file

@ -0,0 +1,263 @@
body {
font-family: "Helvetica Neue", Arial, sans-serif;
background: #FFF;
color: #000;
margin: 0px;
font-size: 0.82em;
line-height: 1.25em;
}
a {
color: #00F;
text-decoration: none;
}
a:hover {
color: #333;
background: #FE8;
}
p {
margin-bottom: 1em;
}
h1 {
font-size: 2.1em;
font-weight: normal;
line-height: 1.2em;
margin: 1.4em 0 0.7em 0;
}
h2 {
font-size: 1.6em;
margin: 1.8em 0 0.8em 0;
font-weight: normal;
line-height: 1.2em;
}
h3 {
font-size: 1.4em;
color:#555;
margin: 1.4em 0 0.7em 0;
font-weight: normal;
}
h4 {
margin: 1.4em 0 0.5em 0;
font-size: 1em;
}
.clear
{
clear: both;
width: 0; height: 0;
}
dt
{
margin-bottom: 0.3em;
font-weight: bold;
}
dd
{
margin-left: 2em;
margin-bottom: 1em;
}
dd p
{
margin-top: 0.6em;
}
li
{
margin: 0 0 0.5em 2em;
}
ul li
{
list-style: disc;
}
ol li
{
list-style: decimal;
}
.banner
{
background: #EDF3FE;
border-bottom: 1px solid #ccc;
padding: 1em 2em 0.5em 2em;
}
.banner h1
{
font-size: 1.2em;
margin: 0;
}
.banner h1 .type
{
font-size: 0.833em;
display:block;
}
.banner h1 .type,
.banner h1 .parent
{
color: #666;
}
.banner ul
{
margin-top: 0.3em;
margin-bottom: 0;
font-size: 0.85em;
}
.banner li
{
list-style: none;
margin-left: 0;
margin-bottom: 0;
}
pre
{
margin-bottom: 1em;
}
.methods dt
{
width: 1em;
font-size: 1.5em;
color:#AAA;
position: absolute;
font-weight: normal;
margin: 0;
}
.methods dd
{
margin-left: 2.5em;
min-height: 1.8em;
-height: 1.8em;
padding-bottom: 0.8em;
}
.methods ul li
{
margin-right: 0.7em;
margin-left: 0;
list-style: none;
display: inline;
}
#content {
margin: 2em;
margin-left: 3.5em;
margin-right: 3.5em;
}
.sectiontitle {
margin-top: 2em;
margin-bottom: 1.3em;
margin-left: -1.2em;
font-size: 1.2em;
padding: 0 0 0.25em 0;
font-weight: bold;
border-bottom: 1px solid #000;
}
.attr-rw {
padding-right: 1em;
text-align: center;
color: #055;
}
.attr-name {
font-weight: bold;
padding-right: 1em;
}
.attr-desc {
}
tt {
font-size: 1.15em;
}
.attr-value {
font-family: monospace;
padding-left: 1em;
font-size: 1.15em;
}
.dyn-source {
display: none;
background: #fffde8;
color: #000;
border: #ffe0bb dotted 1px;
margin: 0.5em 2em 0.5em 0;
padding: 0.5em;
}
.dyn-source .cmt {
color: #00F;
font-style: italic;
}
.dyn-source .kw {
color: #070;
font-weight: bold;
}
.description pre {
padding: 0.5em;
border: #ffe0bb dotted 1px;
background: #fffde8;
}
.method {
margin-bottom: 2em;
}
.method .description,
.method .sourcecode
{
margin-left: 1.2em;
}
.method h4
{
border-bottom: 1px dotted #999;
padding: 0 0 0.2em 0;
margin-bottom: 0.8em;
font-size: 1.1em;
color:#333;
}
.method .title {
border-bottom: 1px dotted #666;
padding: 0 0 0.15em 0;
margin: 0 0 0.5em 0;
font-size: 1.2em;
line-height: 1.25em;
}
.method .sourcecode p.source-link {
text-indent: 0em;
margin-top: 0.5em;
}
.method .aka {
margin-top: 0.3em;
margin-left: 1em;
font-style: italic;
text-indent: 2em;
}
.method .source-link
{
font-size: 0.85em;
}

383
css/panel.css Executable file
View file

@ -0,0 +1,383 @@
/* Panel (begin) */
.panel
{
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: #FFF;
z-index: 2;
font-family: "Helvetica Neue", "Arial", sans-serif;
//zoom: 1;
}
.panel_tree .results,
.panel_results .tree
{
display: none;
}
/* Header with search box (begin) */
.panel .header
{
width: 100%;
height: 29px;
border-bottom: 1px solid #666;
position: relative;
left: 0; top: 0;
background: #e8e8e8;
}
.panel .header div
{
margin: 0 7px;
}
.panel .header table
{
height: 29px;
width: 100%;
}
.panel .header table td
{
vertical-align: middle;
text-align: middle;
}
.panel .header label
{
position: absolute;
font-size: 12px;
line-height: 29px;
margin-left: 3px;
color: #999;
cursor: text;
}
.panel .header table input
{
width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
display: inline-block;
-webkit-appearance: searchfield;
height: 22px;
//height: auto;
}
/* Header with search box (end) */
/* Results (begin) */
.panel .result
{
position: absolute;
top: 30px;
bottom: 0;
left: 0;
width: 100%;
//height: expression((this.parentNode.offsetHeight - 31));
overflow-y: scroll;
overflow-x: hidden;
-overflow-y: hidden;
background: #EDF3FE url(../i/results_bg.png);
z-index: 2;
//zoom:1;
}
.panel .result ul
{
font-size: 0.8em;
width: 100%;
background: #EDF3FE url(../i/results_bg.png);
//zoom:1;
}
.panel .result ul li
{
height: 46px;
-height: 50px;
//display: inline;
//width: 100%;
//zoom: 1;
overflow: hidden;
padding: 4px 10px 0 10px;
cursor: pointer;
}
.panel .result ul li h1
{
font-size: 13px;
font-weight: normal;
color: #333;
margin-bottom: 2px;
white-space: nowrap;
}
.panel .result ul li p
{
font-size: 11px;
color: #333;
margin-bottom: 2px;
white-space: nowrap;
}
.panel .result ul li h1 i,
.panel .result ul li p.snippet
{
color: #999;
}
.panel .result ul li b
{
color: #000;
}
.panel .result ul li.current
{
background: #3875D7;
}
.panel .result ul li.current h1,
.panel .result ul li.current p
{
color: #DDD;
}
.panel .result ul li.current h1 i,
.panel .result ul li.current p.snippet
{
color: #AAA;
}
.panel .result ul li.current b
{
color: #FFF;
}
.panel .result ul li:hover,
.panel .result ul li.selected
{
background: #d0d0d0;
}
.panel .result ul li.current:hover
{
background: #2965C0;
}
.panel .result ul li .badge
{
margin-right: 0.4em;
margin-left: -0.2em;
padding: 0 0.2em;
color: #000;
}
.panel .result ul li .badge_1
{
background: #ACDBF4;
}
.panel .result ul li.current .badge_1
{
background: #97BFD7;
}
.panel .result ul li .badge_2
{
background: #ACF3C3;
}
.panel .result ul li.current .badge_2
{
background: #98D7AC;
}
.panel .result ul li .badge_3
{
background: #E0F3AC;
}
.panel .result ul li.current .badge_3
{
background: #C4D798;
}
.panel .result ul li .badge_4
{
background: #D7CA98;
}
.panel .result ul li.current .badge_4
{
background: #A6B0AC;
}
.panel .result ul li .badge_5
{
background: #F3C8AC;
}
.panel .result ul li.current .badge_5
{
background: #D7B198;
}
.panel .result ul li .badge_6
{
background: #F3ACC3;
}
.panel .result ul li.current .badge_6
{
background: #D798AB;
}
/* Results (end) */
/* Tree (begin) */ /**/
.panel .tree
{
position: absolute;
top: 30px;
bottom: 0;
left: 0;
width: 100%;
//zoom: 1;
//height: expression((this.parentNode.offsetHeight - 31));
overflow-y: scroll;
overflow-x: hidden;
-overflow-y: hidden;
background: #EDF3FE url(../i/tree_bg.png);
z-index: 30;
}
.panel .tree ul
{
background: #EDF3FE url(../i/tree_bg.png);
}
.panel .tree li
{
cursor: pointer;
overflow: hidden;
//height: 23px;
//display: inline;
//zoom: 1;
//width: 100%;
}
.panel .tree li .content
{
padding-left: 18px;
padding-top: 5px;
height: 18px;
overflow: hidden;
position: relative;
}
.panel .tree li .icon
{
width: 10px;
height: 9px;
background: url(../i/arrows.png);
background-position: 0 -9px;
position: absolute;
left: 1px;
top: 8px;
cursor: default;
}
.panel .tree li.closed .icon
{
background-position: 0 0;
}
.panel .tree ul li h1
{
font-size: 13px;
font-weight: normal;
color: #000;
margin-bottom: 2px;
white-space: nowrap;
}
.panel .tree ul li p
{
font-size: 11px;
color: #666;
margin-bottom: 2px;
white-space: nowrap;
}
.panel .tree ul li h1 i
{
color: #999;
font-style: normal;
}
.panel .tree ul li.empty
{
cursor: text;
}
.panel .tree ul li.empty h1,
.panel .tree ul li.empty p
{
color: #666;
font-style: italic;
}
.panel .tree ul li.current
{
background: #3875D7;
}
.panel .tree ul li.current .icon
{
background-position: -10px -9px;
}
.panel .tree ul li.current.closed .icon
{
background-position: -10px 0;
}
.panel .tree ul li.current h1
{
color: #FFF;
}
.panel .tree ul li.current p
{
color: #CCC;
}
.panel .tree ul li.current.empty h1,
.panel .tree ul li.current.empty p
{
color: #999;
}
.panel .tree ul li:hover
{
background: #d0d0d0;
}
.panel .tree ul li.current:hover
{
background: #2965C0;
}
.panel .tree .stopper
{
display: none;
}
/* Tree (end) */ /**/
/* Panel (end) */

53
css/reset.css Executable file
View file

@ -0,0 +1,53 @@
/* http://meyerweb.com/eric/tools/css/reset/ */
/* v1.0 | 20080212 */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
/* remember to define focus styles! */
:focus {
outline: 0;
}
/* remember to highlight inserts somehow! */
ins {
text-decoration: none;
}
del {
text-decoration: line-through;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
border-collapse: collapse;
border-spacing: 0;
}

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

204
files/README_rdoc.html Normal file
View file

@ -0,0 +1,204 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>README.rdoc</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
README.rdoc
</h1>
<ul class="files">
<li>README.rdoc</li>
<li>Last modified: Fri Oct 23 16:40:42 -0400 2009</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="description">
<h1><a href="../classes/AASM.html">AASM</a> - Ruby state machines</h1>
<p>
This package contains <a href="../classes/AASM.html">AASM</a>, a library
for adding finite state machines to Ruby classes.
</p>
<p>
<a href="../classes/AASM.html">AASM</a> started as the
acts_as_state_machine plugin but has evolved into a more generic library
that no longer targets only ActiveRecord models.
</p>
<p>
<a href="../classes/AASM.html">AASM</a> has the following features:
</p>
<ul>
<li>States
</li>
<li>Machines
</li>
<li>Events
</li>
<li>Transitions
</li>
</ul>
<h2>New Callbacks</h2>
<p>
The callback chain &amp; order on a successful event looks like:
</p>
<pre>
oldstate:exit*
event:before
__find transition, if possible__
transition:on_transition*
oldstate:before_exit
newstate:before_enter
newstate:enter*
__update state__
event:success*
oldstate:after_exit
newstate:after_enter
event:after
obj:aasm_event_fired*
(*) marks old callbacks
</pre>
<h2>Download</h2>
<p>
The latest <a href="../classes/AASM.html">AASM</a> can currently be pulled
from the git repository on github.
</p>
<ul>
<li><a
href="http://github.com/rubyist/aasm/tree/master">github.com/rubyist/aasm/tree/master</a>
</li>
</ul>
<h2>Installation</h2>
<h3>From gemcutter</h3>
<pre>
% sudo gem install gemcutter
% sudo gem tumble
% sudo gem install aasm
</pre>
<h3>From GitHub hosted gems (only older releases are available)</h3>
<pre>
% sudo gem sources -a http://gems.github.com # (you only need to do this once)
% sudo gem install rubyist-aasm
</pre>
<h3>Building your own gems</h3>
<pre>
% rake gem
% sudo gem install pkg/aasm-2.1.gem
</pre>
<h2>Simple Example</h2>
<p>
Here&#8217;s a quick example highlighting some of the features.
</p>
<pre>
class Conversation
include AASM
aasm_initial_state :unread
aasm_state :unread
aasm_state :read
aasm_state :closed
aasm_event :view do
transitions :to =&gt; :read, :from =&gt; [:unread]
end
aasm_event :close do
transitions :to =&gt; :closed, :from =&gt; [:read, :unread]
end
end
</pre>
<h2>A Slightly More Complex Example</h2>
<p>
This example uses a few of the more complex features available.
</p>
<pre>
class Relationship
include AASM
aasm_initial_state Proc.new { |relationship| relationship.strictly_for_fun? ? :intimate : :dating }
aasm_state :dating, :enter =&gt; :make_happy, :exit =&gt; :make_depressed
aasm_state :intimate, :enter =&gt; :make_very_happy, :exit =&gt; :never_speak_again
aasm_state :married, :enter =&gt; :give_up_intimacy, :exit =&gt; :buy_exotic_car_and_wear_a_combover
aasm_event :get_intimate do
transitions :to =&gt; :intimate, :from =&gt; [:dating], :guard =&gt; :drunk?
end
aasm_event :get_married do
transitions :to =&gt; :married, :from =&gt; [:dating, :intimate], :guard =&gt; :willing_to_give_up_manhood?
end
def strictly_for_fun?; end
def drunk?; end
def willing_to_give_up_manhood?; end
def make_happy; end
def make_depressed; end
def make_very_happy; end
def never_speak_again; end
def give_up_intimacy; end
def buy_exotic_car_and_wear_a_combover; end
end
</pre>
<h1>Other Stuff</h1>
<table>
<tr><td valign="top">Author:</td><td>Scott Barron <scott at elitists dot net>
</td></tr>
<tr><td valign="top">License:</td><td>Original code Copyright 2006, 2007, 2008 by Scott Barron. Released under an
MIT-style license. See the LICENSE file included in the distribution.
</td></tr>
</table>
<h2>Warranty</h2>
<p>
This software is provided &#8220;as is&#8221; and without any express or
implied warranties, including, without limitation, the implied warranties
of merchantibility and fitness for a particular purpose.
</p>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>aasm.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
aasm.rb
</h1>
<ul class="files">
<li>lib/aasm/aasm.rb</li>
<li>Last modified: Fri Oct 23 16:40:42 -0400 2009</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/AASM.html">AASM</a></li>
</ul>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>event.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
event.rb
</h1>
<ul class="files">
<li>lib/aasm/event.rb</li>
<li>Last modified: Fri Oct 23 16:40:42 -0400 2009</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/AASM.html">AASM</a></li>
</ul>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>active_record_persistence.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
active_record_persistence.rb
</h1>
<ul class="files">
<li>lib/aasm/persistence/active_record_persistence.rb</li>
<li>Last modified: Fri Oct 23 16:40:42 -0400 2009</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../../classes/AASM.html">AASM</a></li>
</ul>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>persistence.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
persistence.rb
</h1>
<ul class="files">
<li>lib/aasm/persistence.rb</li>
<li>Last modified: Fri Oct 23 16:40:42 -0400 2009</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/AASM.html">AASM</a></li>
</ul>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>state_machine.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
state_machine.rb
</h1>
<ul class="files">
<li>lib/aasm/state_machine.rb</li>
<li>Last modified: Fri Oct 23 16:40:42 -0400 2009</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Required Files</div>
<ul>
<li>ostruct</li>
</ul>
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/AASM.html">AASM</a></li>
</ul>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>state.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
state.rb
</h1>
<ul class="files">
<li>lib/aasm/state.rb</li>
<li>Last modified: Fri Oct 23 16:40:42 -0400 2009</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/AASM.html">AASM</a></li>
</ul>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>state_transition.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
state_transition.rb
</h1>
<ul class="files">
<li>lib/aasm/state_transition.rb</li>
<li>Last modified: Fri Oct 23 16:40:42 -0400 2009</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="sectiontitle">Classes and Modules</div>
<ul>
<li><span class="type">MODULE</span> <a href="../../../classes/AASM.html">AASM</a></li>
</ul>
</div>
</div>
</body>
</html>

52
files/lib/aasm_rb.html Normal file
View file

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>aasm.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
aasm.rb
</h1>
<ul class="files">
<li>lib/aasm.rb</li>
<li>Last modified: Fri Oct 23 16:40:42 -0400 2009</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
</div>
</div>
</body>
</html>

BIN
i/arrows.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

BIN
i/results_bg.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

BIN
i/tree_bg.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

View file

@ -1 +1,15 @@
My GitHub Page
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>aasm 2.1.3
</title>
</head>
<frameset cols="300,*" frameborder="1" border="1" bordercolor="#666666" framespacing="1">
<frame src="panel/index.html" title="Search" name="panel" />
<frame src="files/README_rdoc.html" name="docwin" />
</frameset>
</html>

19
js/jquery-1.3.2.min.js vendored Executable file

File diff suppressed because one or more lines are too long

593
js/jquery-effect.js vendored Normal file
View file

@ -0,0 +1,593 @@
/*
* jQuery UI Effects 1.6rc6
*
* Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/
*/
;(function($) {
$.effects = $.effects || {}; //Add the 'effects' scope
$.extend($.effects, {
version: "1.6rc6",
// Saves a set of properties in a data storage
save: function(element, set) {
for(var i=0; i < set.length; i++) {
if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
}
},
// Restores a set of previously saved properties from a data storage
restore: function(element, set) {
for(var i=0; i < set.length; i++) {
if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
}
},
setMode: function(el, mode) {
if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
return mode;
},
getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
// this should be a little more flexible in the future to handle a string & hash
var y, x;
switch (origin[0]) {
case 'top': y = 0; break;
case 'middle': y = 0.5; break;
case 'bottom': y = 1; break;
default: y = origin[0] / original.height;
};
switch (origin[1]) {
case 'left': x = 0; break;
case 'center': x = 0.5; break;
case 'right': x = 1; break;
default: x = origin[1] / original.width;
};
return {x: x, y: y};
},
// Wraps the element around a wrapper that copies position properties
createWrapper: function(element) {
//if the element is already wrapped, return it
if (element.parent().is('.ui-effects-wrapper'))
return element.parent();
//Cache width,height and float properties of the element, and create a wrapper around it
var props = { width: element.outerWidth(true), height: element.outerHeight(true), 'float': element.css('float') };
element.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');
var wrapper = element.parent();
//Transfer the positioning of the element to the wrapper
if (element.css('position') == 'static') {
wrapper.css({ position: 'relative' });
element.css({ position: 'relative'} );
} else {
var top = element.css('top'); if(isNaN(parseInt(top,10))) top = 'auto';
var left = element.css('left'); if(isNaN(parseInt(left,10))) left = 'auto';
wrapper.css({ position: element.css('position'), top: top, left: left, zIndex: element.css('z-index') }).show();
element.css({position: 'relative', top: 0, left: 0 });
}
wrapper.css(props);
return wrapper;
},
removeWrapper: function(element) {
if (element.parent().is('.ui-effects-wrapper'))
return element.parent().replaceWith(element);
return element;
},
setTransition: function(element, list, factor, value) {
value = value || {};
$.each(list, function(i, x){
unit = element.cssUnit(x);
if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
});
return value;
},
//Base function to animate from one class to another in a seamless transition
animateClass: function(value, duration, easing, callback) {
var cb = (typeof easing == "function" ? easing : (callback ? callback : null));
var ea = (typeof easing == "string" ? easing : null);
return this.each(function() {
var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || '';
if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */
if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; }
//Let's get a style offset
var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove);
var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove);
// The main function to form the object for animation
for(var n in newStyle) {
if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */
&& n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */
&& newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */
&& (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */
&& (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */
) offset[n] = newStyle[n];
}
that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object
// Change style attribute back to original. For stupid IE, we need to clear the damn object.
if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr);
if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove);
if(cb) cb.apply(this, arguments);
});
});
}
});
function _normalizeArguments(a, m) {
var o = a[1] && a[1].constructor == Object ? a[1] : {}; if(m) o.mode = m;
var speed = a[1] && a[1].constructor != Object ? a[1] : o.duration; //either comes from options.duration or the second argument
speed = $.fx.off ? 0 : typeof speed === "number" ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
var callback = o.callback || ( $.isFunction(a[2]) && a[2] ) || ( $.isFunction(a[3]) && a[3] );
return [a[0], o, speed, callback];
}
//Extend the methods of jQuery
$.fn.extend({
//Save old methods
_show: $.fn.show,
_hide: $.fn.hide,
__toggle: $.fn.toggle,
_addClass: $.fn.addClass,
_removeClass: $.fn.removeClass,
_toggleClass: $.fn.toggleClass,
// New effect methods
effect: function(fx, options, speed, callback) {
return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: options || {}, duration: speed, callback: callback }) : null;
},
show: function() {
if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
return this._show.apply(this, arguments);
else {
return this.effect.apply(this, _normalizeArguments(arguments, 'show'));
}
},
hide: function() {
if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
return this._hide.apply(this, arguments);
else {
return this.effect.apply(this, _normalizeArguments(arguments, 'hide'));
}
},
toggle: function(){
if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) || (arguments[0].constructor == Function))
return this.__toggle.apply(this, arguments);
else {
return this.effect.apply(this, _normalizeArguments(arguments, 'toggle'));
}
},
addClass: function(classNames, speed, easing, callback) {
return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
},
removeClass: function(classNames,speed,easing,callback) {
return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
},
toggleClass: function(classNames,speed,easing,callback) {
return ( (typeof speed !== "boolean") && speed ) ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames, speed);
},
morph: function(remove,add,speed,easing,callback) {
return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
},
switchClass: function() {
return this.morph.apply(this, arguments);
},
// helper functions
cssUnit: function(key) {
var style = this.css(key), val = [];
$.each( ['em','px','%','pt'], function(i, unit){
if(style.indexOf(unit) > 0)
val = [parseFloat(style), unit];
});
return val;
}
});
/*
* jQuery Color Animations
* Copyright 2007 John Resig
* Released under the MIT and GPL licenses.
*/
// We override the animation for all of these color styles
$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
$.fx.step[attr] = function(fx) {
if ( fx.state == 0 ) {
fx.start = getColor( fx.elem, attr );
fx.end = getRGB( fx.end );
}
fx.elem.style[attr] = "rgb(" + [
Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0],10), 255), 0),
Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1],10), 255), 0),
Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2],10), 255), 0)
].join(",") + ")";
};
});
// Color Conversion functions from highlightFade
// By Blair Mitchelmore
// http://jquery.offput.ca/highlightFade/
// Parse strings looking for color tuples [255,255,255]
function getRGB(color) {
var result;
// Check if we're already dealing with an array of colors
if ( color && color.constructor == Array && color.length == 3 )
return color;
// Look for rgb(num,num,num)
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
// Look for rgb(num%,num%,num%)
if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
// Look for #a0b1c2
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
// Look for #fff
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
return colors['transparent'];
// Otherwise, we're most likely dealing with a named color
return colors[$.trim(color).toLowerCase()];
}
function getColor(elem, attr) {
var color;
do {
color = $.curCSS(elem, attr);
// Keep going until we find an element that has color, or we hit the body
if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
break;
attr = "backgroundColor";
} while ( elem = elem.parentNode );
return getRGB(color);
};
// Some named colors to work with
// From Interface by Stefan Petre
// http://interface.eyecon.ro/
var colors = {
aqua:[0,255,255],
azure:[240,255,255],
beige:[245,245,220],
black:[0,0,0],
blue:[0,0,255],
brown:[165,42,42],
cyan:[0,255,255],
darkblue:[0,0,139],
darkcyan:[0,139,139],
darkgrey:[169,169,169],
darkgreen:[0,100,0],
darkkhaki:[189,183,107],
darkmagenta:[139,0,139],
darkolivegreen:[85,107,47],
darkorange:[255,140,0],
darkorchid:[153,50,204],
darkred:[139,0,0],
darksalmon:[233,150,122],
darkviolet:[148,0,211],
fuchsia:[255,0,255],
gold:[255,215,0],
green:[0,128,0],
indigo:[75,0,130],
khaki:[240,230,140],
lightblue:[173,216,230],
lightcyan:[224,255,255],
lightgreen:[144,238,144],
lightgrey:[211,211,211],
lightpink:[255,182,193],
lightyellow:[255,255,224],
lime:[0,255,0],
magenta:[255,0,255],
maroon:[128,0,0],
navy:[0,0,128],
olive:[128,128,0],
orange:[255,165,0],
pink:[255,192,203],
purple:[128,0,128],
violet:[128,0,128],
red:[255,0,0],
silver:[192,192,192],
white:[255,255,255],
yellow:[255,255,0],
transparent: [255,255,255]
};
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright 2008 George McGinley Smith
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
$.easing.jswing = $.easing.swing;
$.extend($.easing,
{
def: 'easeOutQuad',
swing: function (x, t, b, c, d) {
//alert($.easing.default);
return $.easing[$.easing.def](x, t, b, c, d);
},
easeInQuad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});
/*
*
* TERMS OF USE - EASING EQUATIONS
*
* Open source under the BSD License.
*
* Copyright 2001 Robert Penner
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
})(jQuery);
/*
* jQuery UI Effects Highlight 1.6rc6
*
* Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Highlight
*
* Depends:
* effects.core.js
*/
(function($) {
$.effects.highlight = function(o) {
return this.queue(function() {
// Create element
var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
// Set options
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
var color = o.options.color || "#ffff99"; // Default highlight color
var oldColor = el.css("backgroundColor");
// Adjust
$.effects.save(el, props); el.show(); // Save & Show
el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
// Animation
var animation = {backgroundColor: oldColor };
if (mode == "hide") animation['opacity'] = 0;
// Animate
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
if(mode == "hide") el.hide();
$.effects.restore(el, props);
if (mode == "show" && $.browser.msie) this.style.removeAttribute('filter');
if(o.callback) o.callback.apply(this, arguments);
el.dequeue();
}});
});
};
})(jQuery);

22
js/main.js Executable file
View file

@ -0,0 +1,22 @@
function toggleSource( id )
{
var $src = $('#' + id).toggle();
$('#l_' + id).html($src.css('display') == 'none' ? 'show' : 'hide');
}
function openCode( url )
{
window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
}
window.highlight = function(url) {
var hash = url.match(/#([^#]+)$/)
if(hash) {
$('a[name=' + hash[1] + ']').parent().effect('highlight', {}, 'slow')
}
}
$(function() {
highlight('#' + location.hash);
});

628
js/searchdoc.js Executable file
View file

@ -0,0 +1,628 @@
Searchdoc = {};
// navigation.js ------------------------------------------
Searchdoc.Navigation = new function() {
this.initNavigation = function() {
var _this = this;
$(document).keydown(function(e) {
_this.onkeydown(e);
}).keyup(function(e) {
_this.onkeyup(e);
});
this.navigationActive = true;
}
this.setNavigationActive = function(state) {
this.navigationActive = state;
this.clearMoveTimeout();
}
this.onkeyup = function(e) {
if (!this.navigationActive) return;
switch(e.keyCode) {
case 37: //Event.KEY_LEFT:
case 38: //Event.KEY_UP:
case 39: //Event.KEY_RIGHT:
case 40: //Event.KEY_DOWN:
case 73: // i - qwerty
case 74: // j
case 75: // k
case 76: // l
case 67: // c - dvorak
case 72: // h
case 84: // t
case 78: // n
this.clearMoveTimeout();
break;
}
}
this.onkeydown = function(e) {
if (!this.navigationActive) return;
switch(e.keyCode) {
case 37: //Event.KEY_LEFT:
case 74: // j (qwerty)
case 72: // h (dvorak)
if (this.moveLeft()) e.preventDefault();
break;
case 38: //Event.KEY_UP:
case 73: // i (qwerty)
case 67: // c (dvorak)
if (e.keyCode == 38 || e.ctrlKey) {
if (this.moveUp()) e.preventDefault();
this.startMoveTimeout(false);
}
break;
case 39: //Event.KEY_RIGHT:
case 76: // l (qwerty)
case 78: // n (dvorak)
if (this.moveRight()) e.preventDefault();
break;
case 40: //Event.KEY_DOWN:
case 75: // k (qwerty)
case 84: // t (dvorak)
if (e.keyCode == 40 || e.ctrlKey) {
if (this.moveDown()) e.preventDefault();
this.startMoveTimeout(true);
}
break;
case 9: //Event.KEY_TAB:
case 13: //Event.KEY_RETURN:
if (this.$current) this.select(this.$current);
break;
}
if (e.ctrlKey && e.shiftKey) this.select(this.$current);
}
this.clearMoveTimeout = function() {
clearTimeout(this.moveTimeout);
this.moveTimeout = null;
}
this.startMoveTimeout = function(isDown) {
if (!$.browser.mozilla && !$.browser.opera) return;
if (this.moveTimeout) this.clearMoveTimeout();
var _this = this;
var go = function() {
if (!_this.moveTimeout) return;
_this[isDown ? 'moveDown' : 'moveUp']();
_this.moveTimout = setTimeout(go, 100);
}
this.moveTimeout = setTimeout(go, 200);
}
this.moveRight = function() {
}
this.moveLeft = function() {
}
this.move = function(isDown) {
}
this.moveUp = function() {
return this.move(false);
}
this.moveDown = function() {
return this.move(true);
}
}
// scrollIntoView.js --------------------------------------
function scrollIntoView(element, view) {
var offset, viewHeight, viewScroll, height;
offset = element.offsetTop;
height = element.offsetHeight;
viewHeight = view.offsetHeight;
viewScroll = view.scrollTop;
if (offset - viewScroll + height > viewHeight) {
view.scrollTop = offset - viewHeight + height;
}
if (offset < viewScroll) {
view.scrollTop = offset;
}
}
// searcher.js --------------------------------------------
Searchdoc.Searcher = function(data) {
this.data = data;
this.handlers = [];
}
Searchdoc.Searcher.prototype = new function() {
var CHUNK_SIZE = 1000, // search is performed in chunks of 1000 for non-bloking user input
MAX_RESULTS = 100, // do not try to find more than 100 results
huid = 1, suid = 1,
runs = 0;
this.find = function(query) {
var queries = splitQuery(query),
regexps = buildRegexps(queries),
highlighters = buildHilighters(queries),
state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++},
_this = this;
this.currentSuid = state.n;
if (!query) return;
var run = function() {
// stop current search thread if new search started
if (state.n != _this.currentSuid) return;
var results = performSearch(_this.data, regexps, queries, highlighters, state),
hasMore = (state.limit > 0 && state.pass < 3);
triggerResults.call(_this, results, !hasMore);
if (hasMore) {
setTimeout(run, 2);
}
runs++;
};
runs = 0;
// start search thread
run();
}
/* ----- Events ------ */
this.ready = function(fn) {
fn.huid = huid;
this.handlers.push(fn);
}
/* ----- Utilities ------ */
function splitQuery(query) {
return jQuery.grep(query.split(/(\s+|\(\)?)/), function(string) { return string.match(/\S/) });
}
function buildRegexps(queries) {
return jQuery.map(queries, function(query) { return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i') });
}
function buildHilighters(queries) {
return jQuery.map(queries, function(query) {
return jQuery.map( query.split(''), function(l, i){ return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2) } ).join('')
});
}
// function longMatchRegexp(index, longIndex, regexps) {
// for (var i = regexps.length - 1; i >= 0; i--){
// if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
// };
// return true;
// }
/* ----- Mathchers ------ */
function matchPass1(index, longIndex, queries, regexps) {
if (index.indexOf(queries[0]) != 0) return false;
for (var i=1, l = regexps.length; i < l; i++) {
if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
};
return true;
}
function matchPass2(index, longIndex, queries, regexps) {
if (index.indexOf(queries[0]) == -1) return false;
for (var i=1, l = regexps.length; i < l; i++) {
if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
};
return true;
}
function matchPassRegexp(index, longIndex, queries, regexps) {
if (!index.match(regexps[0])) return false;
for (var i=1, l = regexps.length; i < l; i++) {
if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
};
return true;
}
/* ----- Highlighters ------ */
function highlightRegexp(info, queries, regexps, highlighters) {
var result = createResult(info);
for (var i=0, l = regexps.length; i < l; i++) {
result.title = result.title.replace(regexps[i], highlighters[i]);
if (i > 0)
result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
};
return result;
}
function hltSubstring(string, pos, length) {
return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
}
function highlightQuery(info, queries, regexps, highlighters) {
var result = createResult(info), pos = 0, lcTitle = result.title.toLowerCase();
pos = lcTitle.indexOf(queries[0]);
if (pos != -1) {
result.title = hltSubstring(result.title, pos, queries[0].length);
}
for (var i=1, l = regexps.length; i < l; i++) {
result.title = result.title.replace(regexps[i], highlighters[i]);
result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
};
return result;
}
function createResult(info) {
var result = {};
result.title = info[0];
result.namespace = info[1];
result.path = info[2];
result.params = info[3];
result.snippet = info[4];
result.badge = info[6];
return result;
}
/* ----- Searching ------ */
function performSearch(data, regexps, queries, highlighters, state) {
var searchIndex = data.searchIndex, // search by title first and then by source
longSearchIndex = data.longSearchIndex,
info = data.info,
result = [],
i = state.from,
l = searchIndex.length,
togo = CHUNK_SIZE,
matchFunc, hltFunc;
while (state.pass < 3 && state.limit > 0 && togo > 0) {
if (state.pass == 0) {
matchFunc = matchPass1;
hltFunc = highlightQuery;
} else if (state.pass == 1) {
matchFunc = matchPass2;
hltFunc = highlightQuery;
} else if (state.pass == 2) {
matchFunc = matchPassRegexp;
hltFunc = highlightRegexp;
}
for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
if (info[i].n == state.n) continue;
if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
info[i].n = state.n;
result.push(hltFunc(info[i], queries, regexps, highlighters));
state.limit--;
}
};
if (searchIndex.length <= i) {
state.pass++;
i = state.from = 0;
} else {
state.from = i;
}
}
return result;
}
function triggerResults(results, isLast) {
jQuery.each(this.handlers, function(i, fn) { fn.call(this, results, isLast) })
}
}
// panel.js -----------------------------------------------
Searchdoc.Panel = function(element, data, tree, frame) {
this.$element = $(element);
this.$input = $('input', element).eq(0);
this.$result = $('.result ul', element).eq(0);
this.frame = frame;
this.$current = null;
this.$view = this.$result.parent();
this.data = data;
this.searcher = new Searchdoc.Searcher(data.index);
this.tree = new Searchdoc.Tree($('.tree', element), tree, this);
this.init();
}
Searchdoc.Panel.prototype = $.extend({}, Searchdoc.Navigation, new function() {
var suid = 1;
this.init = function() {
var _this = this;
var observer = function() {
_this.search(_this.$input[0].value);
};
this.$input.keyup(observer);
this.$input.click(observer); // mac's clear field
this.searcher.ready(function(results, isLast) {
_this.addResults(results, isLast);
})
this.$result.click(function(e) {
_this.$current.removeClass('current');
_this.$current = $(e.target).closest('li').addClass('current');
_this.select();
_this.$input.focus();
});
this.initNavigation();
this.setNavigationActive(false);
}
this.search = function(value, selectFirstMatch) {
value = jQuery.trim(value).toLowerCase();
this.selectFirstMatch = selectFirstMatch;
if (value) {
this.$element.removeClass('panel_tree').addClass('panel_results');
this.tree.setNavigationActive(false);
this.setNavigationActive(true);
} else {
this.$element.addClass('panel_tree').removeClass('panel_results');
this.tree.setNavigationActive(true);
this.setNavigationActive(false);
}
if (value != this.lastQuery) {
this.lastQuery = value;
this.firstRun = true;
this.searcher.find(value);
}
}
this.addResults = function(results, isLast) {
var target = this.$result.get(0);
if (this.firstRun && (results.length > 0 || isLast)) {
this.$current = null;
this.$result.empty();
}
for (var i=0, l = results.length; i < l; i++) {
target.appendChild(renderItem.call(this, results[i]));
};
if (this.firstRun && results.length > 0) {
this.firstRun = false;
this.$current = $(target.firstChild);
this.$current.addClass('current');
if (this.selectFirstMatch) this.select();
scrollIntoView(this.$current[0], this.$view[0])
}
if (jQuery.browser.msie) this.$element[0].className += '';
}
this.open = function(src) {
this.frame.location.href = '../' + src;
if (this.frame.highlight) this.frame.highlight(src);
}
this.select = function() {
this.open(this.$current.data('path'));
}
this.move = function(isDown) {
if (!this.$current) return;
var $next = this.$current[isDown ? 'next' : 'prev']();
if ($next.length) {
this.$current.removeClass('current');
$next.addClass('current');
scrollIntoView($next[0], this.$view[0]);
this.$current = $next;
}
return true;
}
function renderItem(result) {
var li = document.createElement('li'),
html = '', badge = result.badge;
html += '<h1>' + hlt(result.title);
if (result.params) html += '<i>' + result.params + '</i>';
html += '</h1>';
html += '<p>';
if (typeof badge != 'undefined') {
html += '<span class="badge badge_' + (badge % 6 + 1) + '">' + escapeHTML(this.data.badges[badge] || 'unknown') + '</span>';
}
html += hlt(result.namespace) + '</p>';
if (result.snippet) html += '<p class="snippet">' + escapeHTML(result.snippet) + '</p>';
li.innerHTML = html;
jQuery.data(li, 'path', result.path);
return li;
}
function hlt(html) {
return escapeHTML(html).replace(/\u0001/g, '<b>').replace(/\u0002/g, '</b>')
}
function escapeHTML(html) {
return html.replace(/[&<>]/g, function(c) {
return '&#' + c.charCodeAt(0) + ';';
});
}
});
// tree.js ------------------------------------------------
Searchdoc.Tree = function(element, tree, panel) {
this.$element = $(element);
this.$list = $('ul', element);
this.tree = tree;
this.panel = panel;
this.init();
}
Searchdoc.Tree.prototype = $.extend({}, Searchdoc.Navigation, new function() {
this.init = function() {
var stopper = document.createElement('li');
stopper.className = 'stopper';
this.$list[0].appendChild(stopper);
for (var i=0, l = this.tree.length; i < l; i++) {
buildAndAppendItem.call(this, this.tree[i], 0, stopper);
};
var _this = this;
this.$list.click(function(e) {
var $target = $(e.target),
$li = $target.closest('li');
if ($target.hasClass('icon')) {
_this.toggle($li);
} else {
_this.select($li);
}
})
this.initNavigation();
if (jQuery.browser.msie) document.body.className += '';
}
this.select = function($li) {
this.highlight($li);
var path = $li[0].searchdoc_tree_data.path;
if (path) this.panel.open(path);
}
this.highlight = function($li) {
if (this.$current) this.$current.removeClass('current');
this.$current = $li.addClass('current');
}
this.toggle = function($li) {
var closed = !$li.hasClass('closed'),
children = $li[0].searchdoc_tree_data.children;
$li.toggleClass('closed');
for (var i=0, l = children.length; i < l; i++) {
toggleVis.call(this, $(children[i].li), !closed);
};
}
this.moveRight = function() {
if (!this.$current) {
this.highlight(this.$list.find('li:first'));
return;
}
if (this.$current.hasClass('closed')) {
this.toggle(this.$current);
}
}
this.moveLeft = function() {
if (!this.$current) {
this.highlight(this.$list.find('li:first'));
return;
}
if (!this.$current.hasClass('closed')) {
this.toggle(this.$current);
} else {
var level = this.$current[0].searchdoc_tree_data.level;
if (level == 0) return;
var $next = this.$current.prevAll('li.level_' + (level - 1) + ':visible:first');
this.$current.removeClass('current');
$next.addClass('current');
scrollIntoView($next[0], this.$element[0]);
this.$current = $next;
}
}
this.move = function(isDown) {
if (!this.$current) {
this.highlight(this.$list.find('li:first'));
return true;
}
var next = this.$current[0];
if (isDown) {
do {
next = next.nextSibling;
if (next && next.style && next.style.display != 'none') break;
} while(next);
} else {
do {
next = next.previousSibling;
if (next && next.style && next.style.display != 'none') break;
} while(next);
}
if (next && next.className.indexOf('stopper') == -1) {
this.$current.removeClass('current');
$(next).addClass('current');
scrollIntoView(next, this.$element[0]);
this.$current = $(next);
}
return true;
}
function toggleVis($li, show) {
var closed = $li.hasClass('closed'),
children = $li[0].searchdoc_tree_data.children;
$li.css('display', show ? '' : 'none')
if (!show && this.$current && $li[0] == this.$current[0]) {
this.$current.removeClass('current');
this.$current = null;
}
for (var i=0, l = children.length; i < l; i++) {
toggleVis.call(this, $(children[i].li), show && !closed);
};
}
function buildAndAppendItem(item, level, before) {
var li = renderItem(item, level),
list = this.$list[0];
item.li = li;
list.insertBefore(li, before);
for (var i=0, l = item[3].length; i < l; i++) {
buildAndAppendItem.call(this, item[3][i], level + 1, before);
};
return li;
}
function renderItem(item, level) {
var li = document.createElement('li'),
cnt = document.createElement('div'),
h1 = document.createElement('h1'),
p = document.createElement('p'),
icon, i;
li.appendChild(cnt);
li.style.paddingLeft = getOffset(level);
cnt.className = 'content';
if (!item[1]) li.className = 'empty ';
cnt.appendChild(h1);
// cnt.appendChild(p);
h1.appendChild(document.createTextNode(item[0]));
// p.appendChild(document.createTextNode(item[4]));
if (item[2]) {
i = document.createElement('i');
i.appendChild(document.createTextNode(item[2]));
h1.appendChild(i);
}
if (item[3].length > 0) {
icon = document.createElement('div');
icon.className = 'icon';
cnt.appendChild(icon);
}
// user direct assignement instead of $()
// it's 8x faster
// $(li).data('path', item[1])
// .data('children', item[3])
// .data('level', level)
// .css('display', level == 0 ? '' : 'none')
// .addClass('level_' + level)
// .addClass('closed');
li.searchdoc_tree_data = {
path: item[1],
children: item[3],
level: level
}
li.style.display = level == 0 ? '' : 'none';
li.className += 'level_' + level + ' closed';
return li;
}
function getOffset(level) {
return 5 + 18*level + 'px';
}
});

71
panel/index.html Executable file
View file

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>layout</title>
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="../css/panel.css" type="text/css" media="screen" charset="utf-8" />
<script src="search_index.js" type="text/javascript" charset="utf-8"></script>
<script src="tree.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/searchdoc.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
//<![CDATA[
function placeholder() {
if (jQuery.browser.safari) return;
$('#search-label').click(function() {
$('#search').focus();
$('#search-label').hide();
});
$('#search').focus(function() {
$('#search-label').hide();
});
$('#search').blur(function() {
this.value == '' && $('#search-label').show()
});
$('#search')[0].value == '' && $('#search-label').show();
}
$(function() {
placeholder();
var panel = new Searchdoc.Panel($('#panel'), search_data, tree, top.frames[1]);
$('#search').focus();
var s = window.parent.location.search.match(/\?q=([^&]+)/);
if (s) {
s = decodeURIComponent(s[1]).replace(/\+/g, ' ');
if (s.length > 0)
{
$('#search').val(s);
panel.search(s, true);
}
}
})
//]]>
</script>
</head>
<body>
<div class="panel panel_tree" id="panel">
<div class="header">
<div>
<label for="search" id="search-label" style="display: none">Search</label>
<table>
<tr><td>
<input type="Search" placeholder="Search" autosave="searchdoc" results="10" id="search" autocomplete="off"/>
</td></tr>
</table></div>
</div>
<div class="tree">
<ul>
</ul>
</div>
<div class="result">
<ul>
</ul>
</div>
</div>
</body>
</html>

1
panel/search_index.js Normal file

File diff suppressed because one or more lines are too long

1
panel/tree.js Normal file
View file

@ -0,0 +1 @@
var tree = [["","","files",[["README.rdoc","files/README_rdoc.html","",[]],["","","lib",[["","","aasm",[["aasm.rb","files/lib/aasm/aasm_rb.html","",[]],["event.rb","files/lib/aasm/event_rb.html","",[]],["","","persistence",[["active_record_persistence.rb","files/lib/aasm/persistence/active_record_persistence_rb.html","",[]]]],["persistence.rb","files/lib/aasm/persistence_rb.html","",[]],["state.rb","files/lib/aasm/state_rb.html","",[]],["state_machine.rb","files/lib/aasm/state_machine_rb.html","",[]],["state_transition.rb","files/lib/aasm/state_transition_rb.html","",[]]]],["aasm.rb","files/lib/aasm_rb.html","",[]]]]]],["AASM","classes/AASM.html","",[["ClassMethods","classes/AASM/ClassMethods.html","",[]],["InvalidTransition","classes/AASM/InvalidTransition.html"," < RuntimeError",[]],["Persistence","classes/AASM/Persistence.html","",[["ActiveRecordPersistence","classes/AASM/Persistence/ActiveRecordPersistence.html","",[["ClassMethods","classes/AASM/Persistence/ActiveRecordPersistence/ClassMethods.html","",[]],["InstanceMethods","classes/AASM/Persistence/ActiveRecordPersistence/InstanceMethods.html","",[]],["NamedScopeMethods","classes/AASM/Persistence/ActiveRecordPersistence/NamedScopeMethods.html","",[]],["ReadState","classes/AASM/Persistence/ActiveRecordPersistence/ReadState.html","",[]],["WriteState","classes/AASM/Persistence/ActiveRecordPersistence/WriteState.html","",[]],["WriteStateWithoutPersistence","classes/AASM/Persistence/ActiveRecordPersistence/WriteStateWithoutPersistence.html","",[]]]]]],["StateMachine","classes/AASM/StateMachine.html"," < Object",[]],["SupportingClasses","classes/AASM/SupportingClasses.html","",[["Event","classes/AASM/SupportingClasses/Event.html"," < Object",[]],["State","classes/AASM/SupportingClasses/State.html"," < Object",[]],["StateTransition","classes/AASM/SupportingClasses/StateTransition.html"," < Object",[]]]],["UndefinedState","classes/AASM/UndefinedState.html"," < RuntimeError",[]]]]]