key-db 2.1.0 → 2.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 +12 -6
  2. metadata +3 -3
data/lib/keydb.rb CHANGED
@@ -56,24 +56,30 @@ class KeyDB
56
56
  end
57
57
 
58
58
  def access_all type
59
+ to_ignore = []
60
+ File.open(@filename).each_line do |line|
61
+ if Marshal.load(line).split("(---)")[1] != nil
62
+ to_ignore.push(Marshal.load(line).split("(---)")[1])
63
+ end
64
+ end
59
65
  File.open(@filename).each_line do |line|
60
66
  line = Marshal.load(line)
61
67
  @keys_and_vals = line.split('/')
62
68
  if type == "keys"
63
- if line.split("(---)").length == 2
64
- puts
69
+ if line.split("(---)").length == 2 or to_ignore.include? line.split("/")[0]
70
+ print
65
71
  else
66
72
  puts @keys_and_vals[0]
67
73
  end
68
74
  elsif type == "vals"
69
- if line.split("(---)").length == 2
70
- puts
75
+ if line.split("(---)").length == 2 or to_ignore.include? line.split("/")[0]
76
+ print
71
77
  else
72
78
  puts @keys_and_vals[1]
73
79
  end
74
80
  elsif type == "all"
75
- if line.split("(---)").length == 2
76
- puts
81
+ if line.split("(---)").length == 2 or to_ignore.include? line.split("/")[0]
82
+ print
77
83
  else
78
84
  puts line
79
85
  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: 2.1.0
4
+ version: 2.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,8 +11,8 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-05-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: ! 'A database acessible via keys. Added delete_key method. Bug exists
15
- in access_all method. File to require: ''keydb'''
14
+ description: ! 'A database acessible via keys. Added delete_key method. access_all
15
+ bug fixed. File to require: ''keydb'''
16
16
  email: slmnwise@gmail.com
17
17
  executables: []
18
18
  extensions: []