queued_state_machine 0.0.0 → 0.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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -0
  3. data/README.md +3 -0
  4. data/test/test.rb +49 -0
  5. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee5afccef7f058cfd32f2c50641359447a77287c
4
- data.tar.gz: 4125d5ef26e850d7854c3116f96e599cc1e1d0a0
3
+ metadata.gz: 1bce1a64094d63dfe0559092d896211809ee1586
4
+ data.tar.gz: 14254544fe70f96f7abfdf3b89a7aec271521460
5
5
  SHA512:
6
- metadata.gz: 3102ab88418edb28b591044971e0d26b7ae3afc6fb1bb60479d1659f62af425a90932cf343d95767ed93e06ffaaf5912675a95ea930485c7af3ec97c43c9fc49
7
- data.tar.gz: f33a5a56f2c9aec627c8a967b478d03007b0347a57c529d4ac4cecaae5fa1b8f4891567efc02dd872772880db5d0e1fb9f00d6c8fca34b7d24c0e05f3bf07e95
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.
@@ -0,0 +1,3 @@
1
+ # Queued State Machine
2
+ A state machine that supports queuing any callbacks that are triggered during a callback.
3
+ Based off Statesman.
@@ -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.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
- homepage: https://github.com/robfors/queued_state_machine
24
+ - test/test.rb
25
+ homepage: https://github.com/robfors/ruby-queued_state_machine
23
26
  licenses:
24
27
  - MIT
25
28
  metadata: {}