stateful.rb 1.0.1 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3f4cfb8d236347a8d199abc2b7515fd4f5077d87b88e462a412a7cf86579749
4
- data.tar.gz: 7b5d4ccd5763b8b811dad8dd8f8d98d61a1d54868ce047d28d6361d7d4efb016
3
+ metadata.gz: 2839c6d2a810cc8c40ec569ca293893fbcbf352639ff93058ad4d8f0025987ed
4
+ data.tar.gz: 2cbc8fb5a317f8413b67f1ef6231b07271f7b8290200adefea935a3dd3e37c5d
5
5
  SHA512:
6
- metadata.gz: ce7f007acb38f9990ee27a0fe1c3fbaea93094317cf2449560b3c8198acf10940acbaa7a7033c6699fad7b1f19d1a4faf95965e3f2af98e9aa69e50eceeadeaa
7
- data.tar.gz: 62960371a9e9fdc190bbfd97726a43e8e5a0a392becdec48278ded2c4acd6d00aed4a94466b82d1195f964923bd5cc1faa005a4cdda990237c3aadc59f91f2cf
6
+ metadata.gz: 2bf9318595ad13640e2b03855b8279faf5cd3e4183685c0eacfa72fb9756ae9e79f501ef9332e6115e744da6fc4b2f7434e09ef87b0be60ab6a8ba0990048f91
7
+ data.tar.gz: 6043e90aa8571a6328ddc62b902f77f8e448693eeb5248edcb22ab0de1e38a007772b7b0acc6f213e0ec5ab7d479cbf4a9da5e399df095e68594d8230d5e0573
@@ -1,7 +1,6 @@
1
1
  # Stateful/State.rb
2
2
  # Stateful::State
3
3
 
4
- require_relative File.join('..', 'Array', 'shuffle')
5
4
  require_relative 'Transition'
6
5
 
7
6
  module Stateful
@@ -19,7 +18,7 @@ module Stateful
19
18
  def event(event)
20
19
  event_name, new_state = event.keys.first, event.values.first
21
20
  transitions << Transition.new(event_name, new_state)
22
- transitions.shuffle if non_deterministic_event_ordering?
21
+ transitions.shuffle! if non_deterministic_event_ordering?
23
22
  transitions
24
23
  end
25
24
  alias_method :on, :event
@@ -35,8 +34,7 @@ module Stateful
35
34
  def non_deterministic_event_ordering?
36
35
  @options[:non_deterministic_event_ordering] ||
37
36
  @options[:non_deterministic] ||
38
- (@options[:deterministic] && !@options[:deterministic])
37
+ (@options.key?(:deterministic) && !@options[:deterministic])
39
38
  end
40
-
41
39
  end
42
40
  end
@@ -93,8 +93,8 @@ module Stateful
93
93
  def global_non_deterministic_event_ordering?
94
94
  @options[:global_non_deterministic_event_ordering] ||
95
95
  @options[:non_deterministic_event_ordering] ||
96
- @options[:non_deterministic] ||
97
- (@options[:deterministic] && !@options[:deterministic])
96
+ @options[:non_deterministic] ||
97
+ (@options.key?(:deterministic) && !@options[:deterministic])
98
98
  end
99
99
 
100
100
  end
@@ -1,5 +1,5 @@
1
1
  module Stateful
2
2
 
3
- VERSION = '1.0.1'
3
+ VERSION = '1.0.2'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stateful.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoran
@@ -71,7 +71,6 @@ executables: []
71
71
  extensions: []
72
72
  extra_rdoc_files: []
73
73
  files:
74
- - lib/Array/shuffle.rb
75
74
  - lib/Stateful.rb
76
75
  - lib/Stateful/ActiveRecord.rb
77
76
  - lib/Stateful/ActiveRecord/ClassMethods.rb
data/lib/Array/shuffle.rb DELETED
@@ -1,18 +0,0 @@
1
- # Array/shuffle.rb
2
- # Array#shuffle
3
-
4
- # 20130922
5
- # 0.3.0
6
-
7
- # Description: Reorders an array randomly.
8
-
9
- # Changes since 0.2:
10
- # 1. Removed the aliases to their own files.
11
-
12
- class Array
13
-
14
- def shuffle
15
- sort_by{rand}
16
- end
17
-
18
- end