steenzout-sqnc 1.0.4 → 1.0.6

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.
@@ -6,22 +6,17 @@ module Steenzout
6
6
 
7
7
  def self.increment_and_store name
8
8
 
9
- open(@@config[:sequences][name][:location], File::RDWR|File::CREAT, 0644) do |f|
9
+ open(@config[:sequences][name][:location], File::RDWR|File::CREAT, 0644) do |f|
10
10
 
11
11
  begin
12
12
 
13
- p @@config[:implementation]
14
13
  f.flock(File::LOCK_EX)
15
14
 
16
- value = @@sequences[name] # get value from memory
17
- p "from memory #{value}"
18
- value = f.readline().to_i if @@sequences[name].nil? rescue EOFError # get value from file
19
- p "from file #{value}"
20
- value ||= @@config[:sequences][name][:offset] # initialize value to offset if none of the above had a value
21
- p "value=#{value}, offset=#{@@config[:sequences][name][:offset]}"
22
- value += @@config[:sequences][name][:step]
23
- @@sequences[name] = value
24
- p "newvalue=#{value}, increment=#{@@config[:sequences][name][:step]}"
15
+ value = @sequences[name] # get value from memory
16
+ value = f.readline().to_i if @sequences[name].nil? rescue EOFError # get value from file
17
+ value ||= @config[:sequences][name][:offset] # initialize value to offset if none of the above had a value
18
+ value += @config[:sequences][name][:step]
19
+ @sequences[name] = value
25
20
  f << value
26
21
  return value
27
22
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steenzout-sqnc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 4
10
- version: 1.0.4
9
+ - 6
10
+ version: 1.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - steenzout
@@ -46,7 +46,6 @@ extra_rdoc_files:
46
46
  - README.textile
47
47
  files:
48
48
  - lib/sqnc/file/manager.rb
49
- - lib/sqnc/file/manager_file.rb
50
49
  - lib/sqnc/kyotocabinet/manager.rb
51
50
  - lib/sqnc/kyotocabinet/manager_kyotocabinet.rb
52
51
  - lib/sqnc/manager.rb
@@ -1,33 +0,0 @@
1
- module Steenzout
2
-
3
- class SequenceManager
4
-
5
- @@sequences = {}
6
-
7
- def self.load_from_tokyocabinet
8
-
9
- end
10
-
11
- def self.load_from_yaml
12
- config = Steenzout::ConfigurationManager.configuration_for_gem 'steenzout-sqnc'
13
- @@sequences = config[:sequences]
14
- end
15
-
16
- def self.reload
17
- config = Steenzout::ConfigurationManager.configuration_for_gem 'steenzout-sqnc'
18
- load_from_yaml if config[:method] == 'yaml'
19
- end
20
-
21
-
22
- def self.list_sequences
23
- @@sequences
24
- end
25
-
26
- def self.increment_sequence name
27
- @@sequences[name] = @@sequences[name] + 1
28
- end
29
-
30
- reload
31
-
32
- end
33
- end