has_state_machine 0.4.1 → 0.6.0
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: 9f5dce90790fc426f0030f3052f7a09aecc373c5cf71185e4d7a2b22280e834d
|
4
|
+
data.tar.gz: e41c13e77237380c39f420797f2f151a3e615390c3966ac196432f1805370357
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78b889ab38cc3aa0bbf1c7c6f43918894a4afab27be0a4c70ac223b58d8d71521154988ba23c4596110c760295dacdc87005fe67b9709edb894c5c7c64f822ba
|
7
|
+
data.tar.gz: 2e5b88c5c7866ce435593a05d9117fe69839e3f01cba591744466ac91cbcb6e26ac700bea31282e3a6c12d04db3c6ab025a7b2a8bf62ced6f91e96ae17babd05
|
@@ -51,7 +51,7 @@ module HasStateMachine
|
|
51
51
|
# Defines the namespace of the models possible states.
|
52
52
|
# Can be overwritten to use a different namespace.
|
53
53
|
define_singleton_method :workflow_namespace do
|
54
|
-
|
54
|
+
options[:workflow_namespace] || "Workflow::#{self}"
|
55
55
|
end
|
56
56
|
|
57
57
|
##
|
@@ -33,7 +33,7 @@ module HasStateMachine
|
|
33
33
|
def initialize(object)
|
34
34
|
@object = object
|
35
35
|
|
36
|
-
super
|
36
|
+
super(state)
|
37
37
|
end
|
38
38
|
|
39
39
|
##
|
@@ -83,6 +83,8 @@ module HasStateMachine
|
|
83
83
|
rollback_transition unless object.update("#{object.state_attribute}": state)
|
84
84
|
end
|
85
85
|
end
|
86
|
+
|
87
|
+
object.reload.public_send(object.state_attribute) == state
|
86
88
|
end
|
87
89
|
|
88
90
|
private
|
@@ -67,7 +67,7 @@ module HasStateMachine
|
|
67
67
|
# @example Check if a post is published
|
68
68
|
# > post.published?
|
69
69
|
# #=> true
|
70
|
-
define_method "#{state}?" do
|
70
|
+
define_method :"#{state}?" do
|
71
71
|
current_state == state
|
72
72
|
end
|
73
73
|
end
|
@@ -78,7 +78,7 @@ module HasStateMachine
|
|
78
78
|
# Getter for the current state of the model based on the configured state
|
79
79
|
# attribute.
|
80
80
|
def current_state
|
81
|
-
|
81
|
+
self[state_attribute]
|
82
82
|
end
|
83
83
|
|
84
84
|
##
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_state_machine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Hargett
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -29,16 +29,16 @@ dependencies:
|
|
29
29
|
name: sqlite3
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '1.4'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '1.4'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: pry
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|