killian-killian-aasm 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +33 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +74 -0
- data/Rakefile +78 -0
- data/TODO +9 -0
- data/doc/jamis.rb +591 -0
- data/lib/SupportingClasses/event.rb +54 -0
- data/lib/SupportingClasses/state.rb +33 -0
- data/lib/SupportingClasses/state_transition.rb +36 -0
- data/lib/aasm.rb +159 -0
- data/lib/persistence/active_record_persistence.rb +246 -0
- data/lib/persistence/persistence.rb +16 -0
- data/lib/state_machine.rb +35 -0
- metadata +73 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module AASM
|
|
2
|
+
module Persistence
|
|
3
|
+
|
|
4
|
+
# Checks to see this class or any of it's superclasses inherit from
|
|
5
|
+
# ActiveRecord::Base and if so includes ActiveRecordPersistence
|
|
6
|
+
def self.set_persistence(base)
|
|
7
|
+
# Use a fancier auto-loading thingy, perhaps. When there are more persistence engines.
|
|
8
|
+
hierarchy = base.ancestors.map {|klass| klass.to_s}
|
|
9
|
+
|
|
10
|
+
if hierarchy.include?("ActiveRecord::Base")
|
|
11
|
+
require File.join(File.dirname(__FILE__), 'active_record_persistence')
|
|
12
|
+
base.send(:include, AASM::Persistence::ActiveRecordPersistence)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'ostruct'
|
|
2
|
+
|
|
3
|
+
module AASM
|
|
4
|
+
class StateMachine
|
|
5
|
+
def self.[](*args)
|
|
6
|
+
(@machines ||= {})[args]
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.[]=(*args)
|
|
10
|
+
val = args.pop
|
|
11
|
+
(@machines ||= {})[args] = val
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
attr_accessor :states, :events, :initial_state, :config
|
|
15
|
+
attr_reader :name
|
|
16
|
+
|
|
17
|
+
def initialize(name)
|
|
18
|
+
@name = name
|
|
19
|
+
@initial_state = nil
|
|
20
|
+
@states = []
|
|
21
|
+
@events = {}
|
|
22
|
+
@config = OpenStruct.new
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def clone
|
|
26
|
+
klone = super
|
|
27
|
+
klone.states = states.clone
|
|
28
|
+
klone
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def create_state(name, options)
|
|
32
|
+
@states << AASM::SupportingClasses::State.new(name, options) unless @states.include?(name)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: killian-killian-aasm
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 2.0.7
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Scott Barron
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-05-16 00:00:00 -07:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies: []
|
|
15
|
+
|
|
16
|
+
description: AASM is a continuation of the acts as state machine rails plugin, built for plain Ruby objects.
|
|
17
|
+
email: scott@elitists.net
|
|
18
|
+
executables: []
|
|
19
|
+
|
|
20
|
+
extensions: []
|
|
21
|
+
|
|
22
|
+
extra_rdoc_files:
|
|
23
|
+
- README.rdoc
|
|
24
|
+
- MIT-LICENSE
|
|
25
|
+
- TODO
|
|
26
|
+
- CHANGELOG
|
|
27
|
+
files:
|
|
28
|
+
- CHANGELOG
|
|
29
|
+
- MIT-LICENSE
|
|
30
|
+
- Rakefile
|
|
31
|
+
- README.rdoc
|
|
32
|
+
- TODO
|
|
33
|
+
- lib/aasm.rb
|
|
34
|
+
- lib/SupportingClasses/event.rb
|
|
35
|
+
- lib/persistence/active_record_persistence.rb
|
|
36
|
+
- lib/persistence/persistence.rb
|
|
37
|
+
- lib/SupportingClasses/state.rb
|
|
38
|
+
- lib/state_machine.rb
|
|
39
|
+
- lib/SupportingClasses/state_transition.rb
|
|
40
|
+
- doc/jamis.rb
|
|
41
|
+
has_rdoc: true
|
|
42
|
+
homepage: http://github.com/rubyist/aasm
|
|
43
|
+
post_install_message:
|
|
44
|
+
rdoc_options:
|
|
45
|
+
- --line-numbers
|
|
46
|
+
- --inline-source
|
|
47
|
+
- --main
|
|
48
|
+
- README.rdoc
|
|
49
|
+
- --title
|
|
50
|
+
- AASM
|
|
51
|
+
require_paths:
|
|
52
|
+
- lib
|
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - ">="
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: "0"
|
|
58
|
+
version:
|
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
|
+
requirements:
|
|
61
|
+
- - ">="
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: "0"
|
|
64
|
+
version:
|
|
65
|
+
requirements: []
|
|
66
|
+
|
|
67
|
+
rubyforge_project:
|
|
68
|
+
rubygems_version: 1.2.0
|
|
69
|
+
signing_key:
|
|
70
|
+
specification_version: 2
|
|
71
|
+
summary: State machine mixin for Ruby objects
|
|
72
|
+
test_files: []
|
|
73
|
+
|