finite_machine 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +1 -1
- data/README.md +201 -143
- data/lib/finite_machine.rb +6 -6
- data/lib/finite_machine/catchable.rb +20 -12
- data/lib/finite_machine/choice_merger.rb +2 -2
- data/lib/finite_machine/definition.rb +1 -1
- data/lib/finite_machine/dsl.rb +35 -5
- data/lib/finite_machine/env.rb +1 -1
- data/lib/finite_machine/events_map.rb +5 -6
- data/lib/finite_machine/hook_event.rb +1 -1
- data/lib/finite_machine/hooks.rb +2 -2
- data/lib/finite_machine/message_queue.rb +6 -3
- data/lib/finite_machine/observer.rb +7 -7
- data/lib/finite_machine/safety.rb +6 -6
- data/lib/finite_machine/state_machine.rb +19 -16
- data/lib/finite_machine/state_parser.rb +8 -8
- data/lib/finite_machine/subscribers.rb +1 -1
- data/lib/finite_machine/threadable.rb +1 -1
- data/lib/finite_machine/transition.rb +6 -5
- data/lib/finite_machine/transition_builder.rb +4 -4
- data/lib/finite_machine/transition_event.rb +1 -1
- data/lib/finite_machine/version.rb +1 -1
- metadata +12 -9
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
3
|
+
require_relative "callable"
|
4
|
+
require_relative "threadable"
|
5
5
|
|
6
6
|
module FiniteMachine
|
7
7
|
# Class describing a transition associated with a given event
|
@@ -117,7 +117,7 @@ module FiniteMachine
|
|
117
117
|
#
|
118
118
|
# @example
|
119
119
|
# transition = Transition.new(context, name: :go)
|
120
|
-
# transition.to_s # =>
|
120
|
+
# transition.to_s # => "go"
|
121
121
|
#
|
122
122
|
# @return [String]
|
123
123
|
#
|
@@ -132,8 +132,9 @@ module FiniteMachine
|
|
132
132
|
#
|
133
133
|
# @api public
|
134
134
|
def inspect
|
135
|
-
transitions = @states.map { |from, to| "#{from} -> #{to}" }.join(
|
136
|
-
"<##{self.class} @name=#{@name}, @transitions=#{transitions},
|
135
|
+
transitions = @states.map { |from, to| "#{from} -> #{to}" }.join(", ")
|
136
|
+
"<##{self.class} @name=#{@name}, @transitions=#{transitions}, " \
|
137
|
+
"@when=#{@conditions}>"
|
137
138
|
end
|
138
139
|
end # Transition
|
139
140
|
end # FiniteMachine
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
3
|
+
require_relative "event_definition"
|
4
|
+
require_relative "state_definition"
|
5
|
+
require_relative "state_parser"
|
6
|
+
require_relative "transition"
|
7
7
|
|
8
8
|
module FiniteMachine
|
9
9
|
# A class reponsible for building transition out of parsed states
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finite_machine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -39,33 +39,33 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '3.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '3.0'
|
69
69
|
description: A minimal finite state machine with a straightforward syntax. You can
|
70
70
|
quickly model states, add callbacks and use object-oriented techniques to integrate
|
71
71
|
with ORMs.
|
@@ -73,7 +73,10 @@ email:
|
|
73
73
|
- piotr@piotrmurach.com
|
74
74
|
executables: []
|
75
75
|
extensions: []
|
76
|
-
extra_rdoc_files:
|
76
|
+
extra_rdoc_files:
|
77
|
+
- README.md
|
78
|
+
- CHANGELOG.md
|
79
|
+
- LICENSE.txt
|
77
80
|
files:
|
78
81
|
- CHANGELOG.md
|
79
82
|
- LICENSE.txt
|