workflow-join 0.2.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40f7e69d9114f772e7a3057bdbbfedc974dd786d
4
- data.tar.gz: 779672bcd9063eb69d6b5400ebe7318957df3669
3
+ metadata.gz: 7f609a97329dc400e969449c824e52ad91413eee
4
+ data.tar.gz: f441e161a922f387b0b5ee908873c6b8b1db265e
5
5
  SHA512:
6
- metadata.gz: 684b92e932e55d231c37c57f49a43715b7369ad2fae41e8fca5ce1e56d64f3820b5241af20c845fc1423cc1361f428c2644b4fef82277c90edc2859b33b8fb86
7
- data.tar.gz: 9c60b3ff584e173d0a91d9e2a9a5e7dbca12b1e707f4105081fe9882276f93de6c2f2b3944d63e99f0f952a9ec9df772043c77f196c6ab8041967e9442e43a98
6
+ metadata.gz: 7b7762a647e1133c54eb90734c5a8af1e3e18522d1b486f316d25c9d753a27a3b0a0a65f83afe6a50fad229395de36900ffbbfb4960ef6681ec3986786a630a9
7
+ data.tar.gz: 936d6597d74068ba6f79339b1098be00bcead2854fb1f08f4c138bfb57b192c8a198e31271230d983cde2e54e63f2f6d1523df99a783dd2df106b4e3d48ba7dc
data/README.md CHANGED
@@ -39,6 +39,8 @@ class Master
39
39
 
40
40
  # before entering :after_meeting state, wait for @slave to enter :resolved state
41
41
  guard :@slave, inner: :after_meeting, outer: :resolved
42
+ # OR: guard :slave, inner: :after_meeting, outer: :resolved
43
+ # OR: guard inner: :after_meeting, outer: :resolved, &:slave
42
44
  end
43
45
  end
44
46
 
@@ -54,6 +56,55 @@ class Slave
54
56
  end
55
57
  ```
56
58
 
59
+ ### `ActiveRecord` support
60
+
61
+ Introduce two new fields in each model, that uses workflow joins:
62
+
63
+ * `workflow_pending_transitions`,
64
+ * `workflow_pending_callbacks`
65
+
66
+ and enjoy:
67
+
68
+ ```ruby
69
+ class Master < ActiveRecord::Base
70
+ has_one :slave
71
+
72
+ include Workflow
73
+
74
+ workflow do
75
+ state :meeting do
76
+ event :go, transitions_to: :after_meeting
77
+ end
78
+ state :after_meeting
79
+
80
+ # before entering :after_meeting state, wait for @slave to enter :resolved state
81
+ guard :slave, inner: :after_meeting, outer: :resolved
82
+ # OR: guard inner: :after_meeting, outer: :resolved, &:slave
83
+ end
84
+ end
85
+
86
+ class Slave < ActiveRecord::Base
87
+ belongs_to :master
88
+
89
+ include Workflow
90
+
91
+ workflow do
92
+ state :unresolved do
93
+ event :resolve, transitions_to: :resolved
94
+ end
95
+ state :resolved
96
+ end
97
+ end
98
+ ```
99
+
100
+ As a matter of fact, this gem tries to create the fields above on first usage,
101
+ but since it happens in the middle of class loading process, the whole
102
+ application start crashes. That is an intended behavior! The columns will be
103
+ created and simple application restart will enable the feature.
104
+
105
+ This part is hardly tested, though, that’s why the preferred way would be to
106
+ create columns manually.
107
+
57
108
  ## Development
58
109
 
59
110
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,5 +1,5 @@
1
1
  module Workflow
2
2
  module Join
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency 'sqlite3'
33
33
 
34
34
  spec.add_dependency 'workflow', '~> 1.2'
35
- spec.add_dependency 'activerecord'
35
+ spec.add_dependency 'activerecord', '>= 3.2.1', '< 5.0.0'
36
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workflow-join
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksei Matiushkin
@@ -114,14 +114,20 @@ dependencies:
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 3.2.1
118
+ - - "<"
119
+ - !ruby/object:Gem::Version
120
+ version: 5.0.0
118
121
  type: :runtime
119
122
  prerelease: false
120
123
  version_requirements: !ruby/object:Gem::Requirement
121
124
  requirements:
122
125
  - - ">="
123
126
  - !ruby/object:Gem::Version
124
- version: '0'
127
+ version: 3.2.1
128
+ - - "<"
129
+ - !ruby/object:Gem::Version
130
+ version: 5.0.0
125
131
  description: Workflow extension that allows to fork workflows with other workflows
126
132
  and join them at specific states.
127
133
  email: