very_tiny_state_machine 2.0.0 → 2.1.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
  SHA1:
3
- metadata.gz: 8d562b809eb29d6a33b1768b0561f58a45bb22c1
4
- data.tar.gz: 174a24056758854ca81477e763fa6f221b09dcb4
3
+ metadata.gz: 94a25d93f5afee99439408cf0a390a8538508077
4
+ data.tar.gz: 4c1724c530df3c19cd534635ac5ec8a729045387
5
5
  SHA512:
6
- metadata.gz: f1b7420c9020b34027472def39c30bf11c34a3cc63d5c9c925d6237b3d57f09c89dad9329438d06b8ebd84b20e3c0a130dd938697992b4da693b34f12a153c80
7
- data.tar.gz: 3a651a37be0fe7fd52e7c6b399a85dbb6651389c9d7076e0a8e047f0cd4b9c0eaaf151eb56be62085092b8daccb932910fcf53ed5686d1706bba8bbba5d6d3ef
6
+ metadata.gz: 55fd29f305d0c1fb00493718eb99b4e452754827701ffbeebfffdeef9c9f761bbb55f68a8462d603c0fd2ad4cabc20586d1f2c15c857b78adbf26762575149d7
7
+ data.tar.gz: 7aebb517f575428b6ac920db643dd16742a707723ba860aa242fdc55a748fca895f04aecbbfae49bccaf96e41b39b0437dfe90e31d79fe01f9ce62187bdee273
@@ -32,7 +32,7 @@ require 'set'
32
32
  # @automaton.in_state?(:processing) #=> true
33
33
  # @automaton.in_state?(:initialized) #=> false
34
34
  class VeryTinyStateMachine
35
- VERSION = '2.0.0'
35
+ VERSION = '2.1.0'
36
36
 
37
37
  InvalidFlow = Class.new(StandardError) # Gets raised when an impossible transition gets requested
38
38
  UnknownState = Class.new(StandardError) # Gets raised when an unknown state gets requested
@@ -194,10 +194,19 @@ class VeryTinyStateMachine
194
194
  if @callbacks_via.respond_to?("after_entering_#{to}_state", also_protected_and_private=true)
195
195
  @callbacks_via.send("after_entering_#{to}_state")
196
196
  end
197
+
198
+ if @callbacks_via.respond_to?(:after_every_transition, also_protected_and_private=true)
199
+ @callbacks_via.send(:after_every_transition, from, to)
200
+ end
197
201
  end
198
202
 
199
203
  def dispatch_callbacks_before_transition(to)
200
204
  from = @state
205
+
206
+ if @callbacks_via.respond_to?(:before_every_transition, also_protected_and_private=true)
207
+ @callbacks_via.send(:before_every_transition, from, to)
208
+ end
209
+
201
210
  if @callbacks_via.respond_to?("leaving_#{from}_state", also_protected_and_private=true)
202
211
  @callbacks_via.send("leaving_#{from}_state")
203
212
  end
@@ -127,13 +127,15 @@ describe VeryTinyStateMachine do
127
127
  machine.permit_state :running, :stopped
128
128
  machine.permit_transition :started => :running, :running => :stopped, :stopped => :started
129
129
 
130
+ expect(fake_acceptor).to receive(:before_every_transition).with(:started, :running)
130
131
  expect(fake_acceptor).to receive(:leaving_started_state)
131
132
  expect(fake_acceptor).to receive(:entering_running_state)
132
133
  expect(fake_acceptor).to receive(:transitioning_from_started_to_running)
133
134
  expect(fake_acceptor).to receive(:after_transitioning_from_started_to_running_state)
134
135
  expect(fake_acceptor).to receive(:after_leaving_started_state)
135
136
  expect(fake_acceptor).to receive(:after_entering_running_state)
136
-
137
+ expect(fake_acceptor).to receive(:after_every_transition).with(:started, :running)
138
+
137
139
  machine.transition! :running
138
140
  end
139
141
 
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: very_tiny_state_machine 2.0.0 ruby lib
5
+ # stub: very_tiny_state_machine 2.1.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "very_tiny_state_machine"
9
- s.version = "2.0.0"
9
+ s.version = "2.1.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Julik Tarkhanov"]
14
- s.date = "2016-02-04"
14
+ s.date = "2016-11-01"
15
15
  s.description = "You wouldn't beleive how tiny it is"
16
16
  s.email = "me@julik.nl"
17
17
  s.extra_rdoc_files = [
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
33
33
  ]
34
34
  s.homepage = "http://github.com/WeTransfer/very_tiny_state_machine"
35
35
  s.licenses = ["MIT"]
36
- s.rubygems_version = "2.2.2"
36
+ s.rubygems_version = "2.4.5.1"
37
37
  s.summary = "A minuscule state machine for storing state of interesting objects"
38
38
 
39
39
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: very_tiny_state_machine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-04 00:00:00.000000000 Z
11
+ date: 2016-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 2.2.2
122
+ rubygems_version: 2.4.5.1
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: A minuscule state machine for storing state of interesting objects