validating-workflow 0.7.11 → 0.7.12
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 +5 -5
- data/VERSION +1 -1
- data/lib/workflow/state_dependent_validations.rb +37 -34
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 0bcbd76861608f9bd09c58b26e1fa3432f6a8d30
|
|
4
|
+
data.tar.gz: 88ab0b8df00a62d22a1b640612945e703a4df856
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 335c3364245b08788611b9ea16b87db9b6874b3a24f320f50d7a3adbcaa3f26aee99e93fc4aeea6feddffbcf9f3b62a1b5758186d3e559a8d5fa61ea28f2a165
|
|
7
|
+
data.tar.gz: d57788e224f598e158d428ab3e57a25f464dda6dbc2000187dc1b0407062bed3afa6a3774a7d73e2710dfecfeed67ef15b0d845707d78194c7dca0bf5eb6cfdc
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.7.
|
|
1
|
+
0.7.12
|
|
@@ -5,48 +5,51 @@ module Workflow
|
|
|
5
5
|
module StateDependency
|
|
6
6
|
|
|
7
7
|
def self.included(base)
|
|
8
|
-
base.prepend
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
base.prepend Validations
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
module Validations
|
|
12
|
+
|
|
13
|
+
def validate(record)
|
|
14
|
+
if not record.respond_to?(:current_state) or
|
|
15
|
+
perform_validation_for_state?(record.current_state) or
|
|
16
|
+
perform_validation_for_transition?(record.in_transition) or
|
|
17
|
+
perform_validation_for_transition?("#{record.in_exit}_exit") or
|
|
18
|
+
perform_validation_for_transition?("#{record.in_entry}_entry")
|
|
19
|
+
super(record)
|
|
17
20
|
end
|
|
18
21
|
end
|
|
19
|
-
end
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
protected
|
|
24
|
+
def perform_validation_for_state?(state)
|
|
25
|
+
(unless_in_state_option.empty? and if_in_state_option.empty? and
|
|
26
|
+
unless_in_transition_option.empty? and if_in_transition_option.empty?) or
|
|
27
|
+
(if_in_state_option.any? and if_in_state_option.include?(state.to_s)) or
|
|
28
|
+
(unless_in_state_option.any? and not unless_in_state_option.include?(state.to_s))
|
|
29
|
+
end
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
def perform_validation_for_transition?(transition)
|
|
32
|
+
(unless_in_state_option.empty? and if_in_state_option.empty? and
|
|
33
|
+
unless_in_transition_option.empty? and if_in_transition_option.empty?) or
|
|
34
|
+
(if_in_transition_option.any? and if_in_transition_option.include?(transition.to_s)) or
|
|
35
|
+
(unless_in_transition_option.any? and not unless_in_transition_option.include?(transition.to_s))
|
|
36
|
+
end
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
def if_in_state_option
|
|
39
|
+
@if_in_state_option ||= [options[:if_in_state]].flatten.compact.collect(&:to_s)
|
|
40
|
+
end
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
def unless_in_state_option
|
|
43
|
+
@unless_in_state_option ||= [options[:unless_in_state]].flatten.compact.collect(&:to_s)
|
|
44
|
+
end
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
def if_in_transition_option
|
|
47
|
+
@if_in_transition_option ||= [options[:if_in_transition]].flatten.compact.collect(&:to_s)
|
|
48
|
+
end
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
def unless_in_transition_option
|
|
51
|
+
@unless_in_transition_option ||= [options[:unless_in_transition]].flatten.compact.collect(&:to_s)
|
|
52
|
+
end
|
|
50
53
|
end
|
|
51
54
|
end
|
|
52
55
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: validating-workflow
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vladimir Dobriakov
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2018-
|
|
12
|
+
date: 2018-08-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: |
|
|
15
15
|
Validating-Workflow is a finite-state-machine-inspired API for modeling and interacting
|
|
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
67
67
|
version: '0'
|
|
68
68
|
requirements: []
|
|
69
69
|
rubyforge_project:
|
|
70
|
-
rubygems_version: 2.
|
|
70
|
+
rubygems_version: 2.5.2.1
|
|
71
71
|
signing_key:
|
|
72
72
|
specification_version: 3
|
|
73
73
|
summary: A replacement for acts_as_state_machine, an enhancement of workflow.
|