sequel-state-machine 1.0.0 → 1.0.1
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
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eb11cc183e1cfcfc7917f505b02b0f801888492fcf73ac6538e5915972cc799
|
4
|
+
data.tar.gz: 355f305b70481b88cd306aed45e4bd6ec8b8706ecd921f17fb18e872e85ea36c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e26ed08fbc26ece33859b8b68b1ce95573060437054ed1c2e7f69e751c80c5a9d0e29c0ad81ab2c2ec1985c54bcc0fd8327d940329868e7c0937b1baa0f4f64f
|
7
|
+
data.tar.gz: 32164513eb750973c18e54b73defeb9aa3e45635653725733ff4c1f0f1665693a2eecb569b2d749d04010c586c86bf44f20b8558e6c44f5df85ce9c73b47c8de
|
@@ -52,13 +52,22 @@ module Sequel
|
|
52
52
|
|
53
53
|
module InstanceMethods
|
54
54
|
def failed?
|
55
|
-
|
56
|
-
|
55
|
+
from_state = self._get_mapped_column_value(:from_state)
|
56
|
+
to_state = self._get_mapped_column_value(:to_state)
|
57
|
+
return from_state == to_state
|
57
58
|
end
|
58
59
|
|
59
60
|
def succeeded?
|
60
|
-
|
61
|
-
|
61
|
+
return !self.failed?
|
62
|
+
end
|
63
|
+
|
64
|
+
def full_message
|
65
|
+
msg = self._get_mapped_column_value(:messages)
|
66
|
+
return self.class.state_machine_messages_supports_array ? msg.join(", ") : msg
|
67
|
+
end
|
68
|
+
|
69
|
+
def _get_mapped_column_value(col)
|
70
|
+
return self[self.class.state_machine_column_mappings[col]]
|
62
71
|
end
|
63
72
|
end
|
64
73
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "state_machines"
|
4
|
+
|
3
5
|
module StateMachines
|
4
6
|
module Sequel
|
5
7
|
class CurrentActorAlreadySet < StateMachines::Error; end
|
@@ -11,11 +13,12 @@ module StateMachines
|
|
11
13
|
@event = event
|
12
14
|
@object = obj
|
13
15
|
msg = "#{obj.class}[#{obj.id}] failed to transition on #{event}"
|
14
|
-
if obj.respond_to?(:audit_logs) && obj.audit_logs.
|
16
|
+
if obj.respond_to?(:audit_logs) && !obj.audit_logs.empty?
|
15
17
|
@audit_log = obj.audit_logs.max_by(&:id)
|
16
|
-
msg += ": #{@audit_log.
|
18
|
+
msg += ": #{@audit_log.full_message}"
|
19
|
+
msg = msg.tr("\n", " ").strip
|
17
20
|
end
|
18
|
-
super(msg)
|
21
|
+
super(obj, msg)
|
19
22
|
end
|
20
23
|
end
|
21
24
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel-state-machine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lithic Tech
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|