key-db 0.0.1 → 0.0.2

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/hashkeydb.rb +10 -4
  2. metadata +2 -2
data/lib/hashkeydb.rb CHANGED
@@ -5,7 +5,7 @@ class HashKeyDB
5
5
  db_file.close
6
6
  end
7
7
  def new_key keyname, value
8
- @db_file = File.open(@filename, "w")
8
+ @db_file = File.open(@filename, "a")
9
9
  @to_write = ("#{keyname}/#{value}")
10
10
  @db_file.write(@to_write)
11
11
  @db_file.write("\n")
@@ -14,9 +14,15 @@ class HashKeyDB
14
14
  def recall_key keyname
15
15
  File.open(@filename, "r").each_line do |line|
16
16
  if line[keyname]
17
- @val = line.split("/")
18
- puts @val[1]
17
+ val = line.split("/")
18
+ puts val[1]
19
19
  end
20
20
  end
21
21
  end
22
- end
22
+ def keys
23
+ File.open(@filename).each_line do |line|
24
+ @key = line.split('/')
25
+ puts @key[0]
26
+ end
27
+ end
28
+ 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: 0.0.1
4
+ version: 0.0.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-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: A database acessible via keys
14
+ description: A database acessible via keys, now with a 'keys' function
15
15
  email: slmnwise@gmail.com
16
16
  executables: []
17
17
  extensions: []