aasm 4.4.0 → 4.4.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/lib/aasm/instance_base.rb +3 -0
- data/lib/aasm/version.rb +1 -1
- data/spec/unit/inspection_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 160b57e7537df5bf2c7674413fc7f6161fcabd97
|
4
|
+
data.tar.gz: d93ae11e0573b50630b3d51f4f8a288f604b7f71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7883c3bdee6cfd956892d7f28df277a018b7ca87818f43162a61d6d977d7c52569aa212c7fbc48e1063822b1e0d7190536fcedf29fd02fa4fd400abbd0046bf1
|
7
|
+
data.tar.gz: 04402315cb576772b5fb42e704a65d1717c583ce7d690597cb1c311af27a9ac7098be39a3c3acfa524ef1b3002b7cc74cf030709e85523bb4f5ca77efeb4eb6e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 4.4.1
|
4
|
+
|
5
|
+
* add support for rejecting certain events on inspection (see [issue #272](https://github.com/aasm/aasm/issues/272) for details, thanks to [@dubroe](https://github.com/dubroe))
|
6
|
+
|
3
7
|
## 4.4.0
|
4
8
|
|
5
9
|
* add support global transation callbacks (see [issue #221](https://github.com/aasm/aasm/issues/221) and [issue #253](https://github.com/aasm/aasm/issues/253) for details)
|
data/README.md
CHANGED
@@ -712,6 +712,8 @@ job.aasm.states(:permitted => true).map(&:name)
|
|
712
712
|
# show all possible (triggerable) events (allowed by transitions)
|
713
713
|
job.aasm.events.map(&:name)
|
714
714
|
=> [:sleep]
|
715
|
+
job.aasm.events(:reject => :sleep).map(&:name)
|
716
|
+
=> []
|
715
717
|
|
716
718
|
# list states for select
|
717
719
|
Job.aasm.states_for_select
|
data/lib/aasm/instance_base.rb
CHANGED
@@ -49,6 +49,9 @@ module AASM
|
|
49
49
|
state = options[:state] || current_state
|
50
50
|
events = @instance.class.aasm(@name).events.select {|e| e.transitions_from_state?(state) }
|
51
51
|
|
52
|
+
options[:reject] = Array(options[:reject])
|
53
|
+
events.reject! { |e| options[:reject].include?(e.name) }
|
54
|
+
|
52
55
|
if options[:permitted]
|
53
56
|
# filters the results of events_for_current_state so that only those that
|
54
57
|
# are really currently possible (given transition guards) are shown.
|
data/lib/aasm/version.rb
CHANGED
@@ -103,4 +103,9 @@ describe 'permitted events' do
|
|
103
103
|
expect(foo.aasm.events(:permitted => true)).to include(:close)
|
104
104
|
expect(foo.aasm.events(:permitted => true)).not_to include(:null)
|
105
105
|
end
|
106
|
+
|
107
|
+
it 'should not include events in the reject option' do
|
108
|
+
expect(foo.aasm.events(:permitted => true, reject: :close)).not_to include(:close)
|
109
|
+
expect(foo.aasm.events(:permitted => true, reject: [:close])).not_to include(:close)
|
110
|
+
end
|
106
111
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aasm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.4.
|
4
|
+
version: 4.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Barron
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-10-
|
13
|
+
date: 2015-10-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|