aasm_statecharts 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- data/README.md +74 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68fbc4a0762a4458ef3f23516302bb7a4f637064
|
4
|
+
data.tar.gz: a6b4caa74d5316079f486f2411e7c8dfb45af463
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40b731b6d28475247efde04ef95c387e841c61e07da0c7bda88b35d3a558d11435075a0cac763f19f4c490d192b2c14dbe53636d88bccf1d607a12f95289f019
|
7
|
+
data.tar.gz: 02392dabebb21d3b78949bed760b7df41a381af2d20f2c7c21db5893c351a0cb916b6e2b56a252d7db17700d797502685f6c83338bdc655d72c818c7930b5d08
|
data/README.md
CHANGED
@@ -0,0 +1,74 @@
|
|
1
|
+
aasm_statecharts
|
2
|
+
================
|
3
|
+
|
4
|
+
`aasm_statecharts` is a utility for generating UML statechart diagrams from state machines defined using [AASM](https://github.com/aasm/aasm). Unlike other state diagram generators, it can express extended finite state machine concepts such as guards and entry actions.
|
5
|
+
|
6
|
+
Installation and Invokation
|
7
|
+
---------------------------
|
8
|
+
|
9
|
+
You can install `aasm_statecharts` from RubyGems using `gem install aasm_statecharts`, or add the `aasm_statecharts` gem to your Gemfile and run Bundler to install it.
|
10
|
+
|
11
|
+
If you have installed `aasm_statecharts` via gem, you can invoke it using the command `aasm_statecharts`; otherwise, if you have used Bundler without generating binstubs, you can invoke it with the command `bundle exec aasm_statecharts`. The following assumes that it has been installed via gem for simplicity.
|
12
|
+
|
13
|
+
Example
|
14
|
+
-------
|
15
|
+
|
16
|
+
Considuer following model, which is assumed to be stored in `app/models/claim.rb`:
|
17
|
+
```rb
|
18
|
+
class Claim < ActiveRecord::Base
|
19
|
+
belongs_to :user
|
20
|
+
validates :title, presence: true
|
21
|
+
validates :description, presence: true
|
22
|
+
|
23
|
+
include AASM
|
24
|
+
|
25
|
+
aasm do
|
26
|
+
state :unsubmitted, initial: true
|
27
|
+
state :submitted, exit: [:cancel_deadline, :close_ticket]
|
28
|
+
state :resolved, final: true
|
29
|
+
|
30
|
+
event :submit do
|
31
|
+
transitions from: :unsubmitted, to: :submitted,
|
32
|
+
guard: :accepting_claims?,
|
33
|
+
on_transition: :notify_submitted
|
34
|
+
end
|
35
|
+
event :return do
|
36
|
+
transitions from: :submitted, to: :unsubmitted
|
37
|
+
end
|
38
|
+
event :accept do
|
39
|
+
transitions from: :submitted, to: :resolved
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def accepting_claims?
|
44
|
+
end
|
45
|
+
|
46
|
+
def cancel_deadline
|
47
|
+
end
|
48
|
+
|
49
|
+
def close_ticket
|
50
|
+
end
|
51
|
+
|
52
|
+
def notify_submitted
|
53
|
+
end
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
If we invoke `aasm_statecharts claim`, then the following diagram will be written to ./doc/claim.png:
|
58
|
+
|
59
|
+

|
60
|
+
|
61
|
+
|
62
|
+
Usage
|
63
|
+
-----
|
64
|
+
|
65
|
+
For more advanced usage information, see `aasm_statecharts --help`:
|
66
|
+
|
67
|
+
Usage: aasm_statecharts [options] <model> [models ...]
|
68
|
+
-a, --all Render all models using AASM
|
69
|
+
-d, --directory directory Output to a specific directory (default: ./doc)
|
70
|
+
-t, --file-type type Output in the specified format (default: png),
|
71
|
+
which must be one of the following: bmp, canon, dot, xdot, cmap, dia, eps, fig, gd,
|
72
|
+
gd2, gif, gtk, hpgl, ico, imap, cmapx, imap_np, cmapx_np, ismap, jpeg, jpg, jpe, mif,
|
73
|
+
mp, pcl, pdf, pic, plain, plain-ext, png, ps, ps2, svg, svgz, tga, tiff, tif, vml,
|
74
|
+
vmlz, vrml, vtx, wbmp, xlib, none.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aasm_statecharts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brendan MacDonell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|