test_ids 0.8.1 → 0.8.2

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: 398ea9b7ec2c5bad27c399d18f0e94d55e505cdb
4
- data.tar.gz: 7474a3c2854ad487f8433316c74098dddcae3f92
3
+ metadata.gz: 131ee6beb6b36186d39111f96c2ba0c06d9a71fd
4
+ data.tar.gz: 5d4fc2e812a336213246939bf1f23b61739a35c8
5
5
  SHA512:
6
- metadata.gz: 901efb539a198fa3ba56c50b948dd75a70217e5d7b03fb2c8febfa34e06e5cb69a4c3784e18c11c62677eda9b051c3c4f67b2609dcc071b166d64719ede8888f
7
- data.tar.gz: 06cd20a662de6515f40674ef866ef5b6807e99658c9087b88dc3fa46b0943bc07f58bc5c6fdc66c0cb029a16a56fbfb89a68198fd1586068aa85f91eef1da738
6
+ metadata.gz: 91110e14f7c4ff5f63fdb3011abca0e3ecaf774423a1002a6a5db73ce3bdf0fd33bc31cdde8e6d3887cf4c1e5dd37c5dd8fc0112fc7ca1c096320e9bcae50530
7
+ data.tar.gz: fed24675c4d9754fce08d539b43039a7bda4c838c5cd5daa378d94fbcff05151a314b70a20185c514b4a15012371e5aab9fe5d9b3b0324acefe20bddbf89d37e
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module TestIds
2
2
  MAJOR = 0
3
3
  MINOR = 8
4
- BUGFIX = 1
4
+ BUGFIX = 2
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
@@ -26,8 +26,19 @@ module TestIds
26
26
 
27
27
  def range_item(range, options)
28
28
  orig_options = options.dup
29
- # Create an alias for the databse that stores the pointers per range
30
- rangehash = store['pointers']['ranges'] ||= {}
29
+ # Now Check if the database (JSON file) exists.
30
+ # If file exists, load the database and create the alias for ['pointer']['ranges']
31
+ if file && File.exist?(file)
32
+ lines = File.readlines(file)
33
+ # Remove any header comment lines since these are not valid JSON
34
+ lines.shift while lines.first =~ /^\/\// && !lines.empty?
35
+ s = JSON.load(lines.join("\n"))
36
+ rangehash = s['pointers']['ranges']
37
+ rangehash = Hash[rangehash.map { |k, v| [k.to_sym, v] }]
38
+ else
39
+ # Create an alias for the databse that stores the pointers per range
40
+ rangehash = store['pointers']['ranges'] ||= {}
41
+ end
31
42
  # Check the database to see if the passed in range has already been included in the database hash
32
43
  if rangehash.key?(:"#{range}")
33
44
  # Read out the database hash to see what the last_softbin given out was for that range.
@@ -47,12 +58,12 @@ module TestIds
47
58
  assigned_value = range.to_a[@pointer]
48
59
  end
49
60
  # Now update the database pointers to point to the lastest assigned softbin for a given range.
50
- rangehash.merge!("#{range}": "#{range.to_a[@pointer]}")
61
+ rangehash.merge!(:"#{range}" => "#{range.to_a[@pointer]}")
51
62
  else
52
63
  # This is the case for a brand new range that has not been passed before
53
64
  # We start from the first value as the assigned softbin and update the database to reflect.
54
65
  @pointer = 0
55
- rangehash.merge!("#{range}": "#{range.to_a[@pointer]}")
66
+ rangehash.merge!(:"#{range}" => "#{range.to_a[@pointer]}")
56
67
  assigned_value = range.to_a[@pointer]
57
68
  end
58
69
  unless !assigned_value.nil? && assigned_value.between?(range.min, range.max)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_ids
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-15 00:00:00.000000000 Z
11
+ date: 2018-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen