validating-workflow 0.7.11 → 0.7.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: a64c292b5e55fd0a34d1d0a6aa8db38a286be829255ffe265756ecd84fcfd58d
4
- data.tar.gz: fb9d9b112127f4a9c59d251f4526c06686d1ac55551d60c4b250bd5ff4cfd95e
2
+ SHA1:
3
+ metadata.gz: 0bcbd76861608f9bd09c58b26e1fa3432f6a8d30
4
+ data.tar.gz: 88ab0b8df00a62d22a1b640612945e703a4df856
5
5
  SHA512:
6
- metadata.gz: c6396c75739da00addbca0d3e3615bc7fad0f5296677f8c305468d31d2f2da4c75e3756933e8e5ae83a860ae57a7061790ab0471d35ca516bab00636b0904027
7
- data.tar.gz: f8316fdf4a000d0638f440df5edb918b8a5536d466c52c17e137d7f8ccc563164615e4ab813394f7d31055f920b3bacbb85e3529e4ff9d7e0a5060cdadb6b6e6
6
+ metadata.gz: 335c3364245b08788611b9ea16b87db9b6874b3a24f320f50d7a3adbcaa3f26aee99e93fc4aeea6feddffbcf9f3b62a1b5758186d3e559a8d5fa61ea28f2a165
7
+ data.tar.gz: d57788e224f598e158d428ab3e57a25f464dda6dbc2000187dc1b0407062bed3afa6a3774a7d73e2710dfecfeed67ef15b0d845707d78194c7dca0bf5eb6cfdc
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.11
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 Module.new do
9
- def validate(record)
10
- if not record.respond_to?(:current_state) or
11
- perform_validation_for_state?(record.current_state) or
12
- perform_validation_for_transition?(record.in_transition) or
13
- perform_validation_for_transition?("#{record.in_exit}_exit") or
14
- perform_validation_for_transition?("#{record.in_entry}_entry")
15
- super(record)
16
- end
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
- protected
22
- def perform_validation_for_state?(state)
23
- (unless_in_state_option.empty? and if_in_state_option.empty? and
24
- unless_in_transition_option.empty? and if_in_transition_option.empty?) or
25
- (if_in_state_option.any? and if_in_state_option.include?(state.to_s)) or
26
- (unless_in_state_option.any? and not unless_in_state_option.include?(state.to_s))
27
- end
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
- def perform_validation_for_transition?(transition)
30
- (unless_in_state_option.empty? and if_in_state_option.empty? and
31
- unless_in_transition_option.empty? and if_in_transition_option.empty?) or
32
- (if_in_transition_option.any? and if_in_transition_option.include?(transition.to_s)) or
33
- (unless_in_transition_option.any? and not unless_in_transition_option.include?(transition.to_s))
34
- end
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
- def if_in_state_option
37
- @if_in_state_option ||= [options[:if_in_state]].flatten.compact.collect(&:to_s)
38
- end
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
- def unless_in_state_option
41
- @unless_in_state_option ||= [options[:unless_in_state]].flatten.compact.collect(&:to_s)
42
- end
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
- def if_in_transition_option
45
- @if_in_transition_option ||= [options[:if_in_transition]].flatten.compact.collect(&:to_s)
46
- end
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
- def unless_in_transition_option
49
- @unless_in_transition_option ||= [options[:unless_in_transition]].flatten.compact.collect(&:to_s)
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.11
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-05-25 00:00:00.000000000 Z
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.7.6
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.