key-db 2.4.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Diagram.jpg +0 -0
- data/lib/keydb.rb +15 -26
- metadata +4 -3
data/Diagram.jpg
ADDED
Binary file
|
data/lib/keydb.rb
CHANGED
@@ -11,7 +11,7 @@ class KeyDB
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def new_key keyname, value
|
14
|
-
if keyname =~ /\/\/\/|\(---\)
|
14
|
+
if keyname =~ /\/\/\/|\(---\)|-\*\*\*-/
|
15
15
|
raise "Invalid Keyname!"
|
16
16
|
return
|
17
17
|
end
|
@@ -64,40 +64,29 @@ class KeyDB
|
|
64
64
|
@db_file.close
|
65
65
|
end
|
66
66
|
|
67
|
-
def
|
68
|
-
|
69
|
-
|
67
|
+
def to_s
|
68
|
+
return "KeyDB-#{@filename}"
|
69
|
+
end
|
70
|
+
|
71
|
+
def keys
|
72
|
+
to_ignore = Array.new
|
70
73
|
File.open(@filename).each_line do |line|
|
71
74
|
if Marshal.load(line).split("(---)")[1] != nil
|
72
75
|
to_ignore.push(Marshal.load(line).split("(---)")[1])
|
73
|
-
|
74
|
-
|
75
|
-
to_change[Marshal.load(line).split("-***-")[1]] = Marshal.load(line).split("-***-")[2]
|
76
|
+
elsif Marshal.load(line).split("-***-")[1] != nil
|
77
|
+
to_ignore.push(Marshal.load(line).split("-***-")[1])
|
76
78
|
end
|
77
79
|
end
|
80
|
+
puts to_ignore
|
78
81
|
File.open(@filename).each_line do |line|
|
79
82
|
line = Marshal.load(line)
|
80
83
|
@keys_and_vals = line.split('///')
|
81
|
-
if
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
puts @keys_and_vals[0]
|
86
|
-
end
|
87
|
-
elsif type == "vals"
|
88
|
-
if line.split("(---)").length == 2 or to_ignore.include? line.split("///")[0]
|
89
|
-
print
|
90
|
-
else
|
91
|
-
puts @keys_and_vals[1]
|
92
|
-
end
|
93
|
-
elsif type == "all"
|
94
|
-
if line.split("(---)").length == 2 or to_ignore.include? line.split("///")[0]
|
95
|
-
print
|
96
|
-
else
|
97
|
-
puts line
|
98
|
-
end
|
84
|
+
if line.split("(---)").length == 2 or to_ignore.include? line.split("///")[0]
|
85
|
+
print
|
86
|
+
elsif to_ignore.include? line.split("-***-")[1]
|
87
|
+
print
|
99
88
|
else
|
100
|
-
|
89
|
+
puts @keys_and_vals[0]
|
101
90
|
end
|
102
91
|
end
|
103
92
|
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:
|
4
|
+
version: 3.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,14 +12,15 @@ cert_chain: []
|
|
12
12
|
date: 2012-05-15 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! 'A database acessible via keys. Added change_key method. change_key
|
15
|
-
|
16
|
-
|
15
|
+
can also be used to create new keys, although that method is slower. Added to_s
|
16
|
+
method. File to require: ''keydb'''
|
17
17
|
email: slmnwise@gmail.com
|
18
18
|
executables: []
|
19
19
|
extensions: []
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
22
|
- lib/keydb.rb
|
23
|
+
- Diagram.jpg
|
23
24
|
homepage: http://rubygems.org/gems/key-db
|
24
25
|
licenses: []
|
25
26
|
post_install_message:
|