key-db 0.1.0 → 0.2.0
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.
- data/lib/hashkeydb.rb +3 -1
- metadata +2 -2
data/lib/hashkeydb.rb
CHANGED
@@ -8,13 +8,14 @@ class HashKeyDB
|
|
8
8
|
end
|
9
9
|
def new_key keyname, value
|
10
10
|
@db_file = File.open(@filename, "a")
|
11
|
-
@to_write = ("#{keyname}/#{value}")
|
11
|
+
@to_write = (Marshal.dump("#{keyname}/#{value}"))
|
12
12
|
@db_file.write(@to_write)
|
13
13
|
@db_file.write("\n")
|
14
14
|
@db_file.close
|
15
15
|
end
|
16
16
|
def recall_key keyname
|
17
17
|
File.open(@filename, "r").each_line do |line|
|
18
|
+
line = Marshal.load(line)
|
18
19
|
if line[keyname]
|
19
20
|
val = line.split("/")
|
20
21
|
puts val[1]
|
@@ -23,6 +24,7 @@ class HashKeyDB
|
|
23
24
|
end
|
24
25
|
def access type
|
25
26
|
File.open(@filename).each_line do |line|
|
27
|
+
line = Marshal.load(line)
|
26
28
|
@keys_and_vals = line.split('/')
|
27
29
|
if type == "keys"
|
28
30
|
index = 0
|
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: 0.
|
4
|
+
version: 0.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-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description: A database acessible via keys, all bugs fixed
|
14
|
+
description: A database acessible via keys, all bugs fixed, marshaling included
|
15
15
|
email: slmnwise@gmail.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|