patronus_fati 1.3.2 → 1.3.3

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
  SHA1:
3
- metadata.gz: 07a8361617b376ebc2b0b54743d430ddaa62a2f6
4
- data.tar.gz: 2e88b6106deb2cf8087e527368477c9330d6e0c7
3
+ metadata.gz: 0decb36cf31bb39312c3aafa0b363d0c445d62f9
4
+ data.tar.gz: 28c87e8a494ccce26639b41a1a00b2cb1a9f9000
5
5
  SHA512:
6
- metadata.gz: 9eef73a1f7ae40c591a5c6b1b0ce5a683da3e5f6501f21bd4d8cb8f28a216c749b0a46ba4cba0dc2fe45657676ba88c83c988ca5382f07041a8c107ea877f68a
7
- data.tar.gz: c7ef5813938f605a3a28a26fcea6f4ddec545cb4f1de36eefe34d076985851ba0d8ad4e81aa0d1f0924622b48ea2560aebec26a56e4922bcdcbd2aeb789ce7f9
6
+ metadata.gz: e92db4e69fb9cde5927add5c1f64b967a9bfe2984e3cf649d6557521fbbd4b91771d1fcdc8e68ff2b52367915a32aca16237f777e451cc7328c58bf6771dbe97
7
+ data.tar.gz: d70418fb785ca6f3270c16dc470fa374e0dbe521992cc538fc1af6dabd8b22b2d6fc196107f61fafc1e98e2ee05205cd909e9994ff64e5b3633b4eb5e74349e3
@@ -29,7 +29,7 @@ module PatronusFati
29
29
  end
30
30
 
31
31
  def set_bit(bit)
32
- raise ArgumentError unless valid_bit?(bit)
32
+ raise ArgumentError, "Bit #{bit} is out of range of #{tracked_count}" unless valid_bit?(bit)
33
33
  self.bits |= (1 << bit - 1)
34
34
  end
35
35
 
@@ -9,13 +9,13 @@ module PatronusFati
9
9
  # appropriate bit within our bit field.
10
10
  def bit_for_time(reference_window, timestamp)
11
11
  offset = timestamp - reference_window
12
- raise ArgumentError if offset < 0 || offset > WINDOW_LENGTH
12
+ raise ArgumentError if offset < 0 || offset >= WINDOW_LENGTH
13
13
  (offset / INTERVAL_DURATION) + 1
14
14
  end
15
15
 
16
16
  # Get the bit representing our current interval within the window
17
17
  def current_bit_offset
18
- bit_for_time(current_window_start, Time.now.to_i)
18
+ bit_for_time(window_start, Time.now.to_i)
19
19
  end
20
20
 
21
21
  # Returns the unix timestamp of the beginning of the current window.
@@ -38,7 +38,7 @@ module PatronusFati
38
38
  end
39
39
 
40
40
  def last_window_start
41
- current_window_start - WINDOW_LENGTH
41
+ window_start - WINDOW_LENGTH
42
42
  end
43
43
 
44
44
  # Provides the beginning of the last interval when the tracked object was
@@ -50,7 +50,7 @@ module PatronusFati
50
50
  return nil if dead?
51
51
 
52
52
  if (bit = current_presence.highest_bit_set)
53
- time_for_bit(current_window_start, bit)
53
+ time_for_bit(window_start, bit)
54
54
  else
55
55
  time_for_bit(last_window_start, last_presence.highest_bit_set)
56
56
  end
@@ -70,10 +70,11 @@ module PatronusFati
70
70
  # a new bit window, this method will move the current window into the old
71
71
  # one, and reset the current bit field.
72
72
  def rotate_presence
73
- return if window_start == current_window_start
73
+ cws = current_window_start
74
+ return if window_start == cws
74
75
 
75
76
  self.last_presence = current_presence
76
- self.window_start = current_window_start
77
+ self.window_start = cws
77
78
  self.current_presence = BitField.new(WINDOW_INTERVALS)
78
79
  end
79
80
 
@@ -1,3 +1,3 @@
1
1
  module PatronusFati
2
- VERSION = '1.3.2'
2
+ VERSION = '1.3.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patronus_fati
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stelfox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-13 00:00:00.000000000 Z
11
+ date: 2017-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: louis