sequel_workflow_persistence 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/sequel_workflow_presistence.rb +21 -0
- data/info/Readme-Workflow-Sequel.md +21 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 611fd306906d3cddf04a6dda9c26279105632a5f369816fce7ccbf9056caa29a
|
4
|
+
data.tar.gz: 183b71b24006424a8d85f8875d0c76356f7615fd1ba98cb467b39cc8d9069782
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d334ac790ce527863dbcd5d536c5842ea69d083c2883415a98343f0ce0bab5c295116eafadef51f6dffe7d02604e6bcaaa7b21aaf37942a5b900ab4387ba3957
|
7
|
+
data.tar.gz: 9ce313eefc8a634c7752f2d3bdacec41a6cf04807911c4242abc589b3fa6793542e4a9e8bbf15edaf909d43802a5cca9653f73692596b18af9a6a6dd1fd48ca3
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module WorkflowSequel
|
2
|
+
def load_workflow_state
|
3
|
+
send( self.class.workflow_column )
|
4
|
+
end
|
5
|
+
|
6
|
+
def persist_workflow_state(new_value)
|
7
|
+
send( "#{self.class.workflow_column}=", new_value )
|
8
|
+
save( changed: true, validate: false)
|
9
|
+
end
|
10
|
+
|
11
|
+
def dataset_update( attrs )
|
12
|
+
@@whitelist ||= (self.columns - [:id]).freeze
|
13
|
+
self.class.instance_dataset.where( id: id ).update( attrs.delete_if{|k,v| [:id, 'id'].include?(k) } )
|
14
|
+
end
|
15
|
+
|
16
|
+
def before_validation
|
17
|
+
send( "#{self.class.workflow_column}=", current_state.to_s ) unless send( self.class.workflow_column )
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Workflow + Sequel persistense adapter
|
2
|
+
|
3
|
+
Simplified version of that https://github.com/tmaier/workflow-sequel/issues.
|
4
|
+
|
5
|
+
Battle tested only with Postgresql.
|
6
|
+
|
7
|
+
## Cat
|
8
|
+
|
9
|
+
class SomeItem < Sequel::Model
|
10
|
+
include Workflow
|
11
|
+
include WorkflowSequel
|
12
|
+
|
13
|
+
workflow_column :finite_state
|
14
|
+
|
15
|
+
# etc...
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
### ::dataset_update( attrs )
|
20
|
+
|
21
|
+
Updates only columns listed in attrs and without :id.
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sequel_workflow_persistence
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- deemytch
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-04-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: workflow
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sequel
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Tested with postgresql only.
|
42
|
+
email: aspamkiller@yandex.ru
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- app/sequel_workflow_presistence.rb
|
48
|
+
- info/Readme-Workflow-Sequel.md
|
49
|
+
homepage: https://github.com/deemytch/workflow-sequel
|
50
|
+
licenses:
|
51
|
+
- GPL-2.0
|
52
|
+
metadata: {}
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- app
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubygems_version: 3.1.2
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: Workflow finite state machines adapted for sequel gem
|
72
|
+
test_files: []
|