key-db 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/keydb.rb +7 -1
- metadata +2 -2
data/lib/keydb.rb
CHANGED
@@ -8,8 +8,11 @@ class KeyDB
|
|
8
8
|
@db_file.close
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def new_key keyname, value
|
13
|
+
if keyname.class != String
|
14
|
+
warn "WARNING: Keyname should be a string"
|
15
|
+
end
|
13
16
|
@db_file = File.open(@filename, "a")
|
14
17
|
@to_write = (Marshal.dump("#{keyname}/#{value}"))
|
15
18
|
@db_file.write(@to_write)
|
@@ -18,6 +21,9 @@ class KeyDB
|
|
18
21
|
end
|
19
22
|
|
20
23
|
def get_key keyname
|
24
|
+
if keyname.class != String
|
25
|
+
warn "WARNING: Keyname should be a string"
|
26
|
+
end
|
21
27
|
File.open(@filename, "r").each_line do |line|
|
22
28
|
line = Marshal.load(line)
|
23
29
|
if line[keyname]
|
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.
|
4
|
+
version: 1.1.2
|
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.
|
14
|
+
description: ! 'A database acessible via keys, bugs fixed. Added Key type warnings.
|
15
15
|
File to require: ''keydb'''
|
16
16
|
email: slmnwise@gmail.com
|
17
17
|
executables: []
|