queued_state_machine 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/README.md +3 -0
- data/test/test.rb +49 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bce1a64094d63dfe0559092d896211809ee1586
|
4
|
+
data.tar.gz: 14254544fe70f96f7abfdf3b89a7aec271521460
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 027090588928b6bb21f9d56d8be772265a4ec54006c6cb41147a6f78bb6dce60d6d7b4b9a0fda0953f6e79937b51c0f480931e0d74c17b9cae2540ee7fbdd4a9
|
7
|
+
data.tar.gz: 1d887bc5bb17be344f235424fcd9b05748154b73adf639852d4df0444d6f2e08ff58c872aaed7111d09e1d9cdd9872dc35794bc93c68a727ab20fad6c64f8b5c
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Rob Fors
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
data/test/test.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'pry'
|
2
|
+
|
3
|
+
require 'queued_state_machine'
|
4
|
+
|
5
|
+
class Test
|
6
|
+
include QueuedStateMachine
|
7
|
+
|
8
|
+
state :a, initial: true
|
9
|
+
state :b
|
10
|
+
state :c
|
11
|
+
|
12
|
+
transition(from: :a, to: [:b, :c])
|
13
|
+
transition(to: :a)
|
14
|
+
|
15
|
+
on_transition(from: :a, to: [:b, :c]) do
|
16
|
+
puts "from: a to: b,c"
|
17
|
+
end
|
18
|
+
|
19
|
+
on_transition(from: :b, to: :c) do
|
20
|
+
puts "from: b to: c"
|
21
|
+
end
|
22
|
+
|
23
|
+
on_transition(from: [:a,:c], to: :b) do
|
24
|
+
puts "from: a,c to: b"
|
25
|
+
end
|
26
|
+
|
27
|
+
on_transition(to: :a) do
|
28
|
+
puts "from: * to: a"
|
29
|
+
puts "start"
|
30
|
+
to(:c)
|
31
|
+
puts "end"
|
32
|
+
end
|
33
|
+
|
34
|
+
def initialize
|
35
|
+
puts "initialize"
|
36
|
+
super
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
t = Test.new
|
42
|
+
t.state
|
43
|
+
t.at?(:a)
|
44
|
+
t.to(:b)
|
45
|
+
puts
|
46
|
+
t.to(:a)
|
47
|
+
puts t.state
|
48
|
+
t.to(:b) # should fail
|
49
|
+
binding.pry
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: queued_state_machine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Fors
|
@@ -17,9 +17,12 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- LICENSE
|
21
|
+
- README.md
|
20
22
|
- lib/queued_state_machine.rb
|
21
23
|
- lib/queued_state_machine/invalid_transition.rb
|
22
|
-
|
24
|
+
- test/test.rb
|
25
|
+
homepage: https://github.com/robfors/ruby-queued_state_machine
|
23
26
|
licenses:
|
24
27
|
- MIT
|
25
28
|
metadata: {}
|