key-db 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/keydb.rb +6 -0
  2. metadata +2 -2
data/lib/keydb.rb CHANGED
@@ -10,6 +10,12 @@ class KeyDB
10
10
  end
11
11
 
12
12
  def new_key keyname, value
13
+ File.open(@filename, "r").each_line do |line|
14
+ if Marshal.load(line)[keyname]
15
+ raise "Keynames must be unique"
16
+ return
17
+ end
18
+ end
13
19
  if keyname.class != String
14
20
  warn "WARNING: Keyname should be a string"
15
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: key-db
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-05-11 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: ! 'A database acessible via keys, bugs fixed. Added Key type warnings.
14
+ description: ! 'A database acessible via keys, bugs fixed. Added required key uniqueness.
15
15
  File to require: ''keydb'''
16
16
  email: slmnwise@gmail.com
17
17
  executables: []