hashlib 0.0.2 → 0.0.3

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/hashlib.rb +5 -5
  2. metadata +1 -1
data/lib/hashlib.rb CHANGED
@@ -22,12 +22,12 @@ class Hash
22
22
 
23
23
  path.each do |p|
24
24
  x, key, subfield, subvalue = p.split(/([a-z0-9\@\_\-\+]+)(?:\[([^=]+)(?:=(.+))?\])?/i)
25
- root = (root[key] rescue nil)
25
+ root = (root[key.to_sym] rescue nil)
26
26
  #puts key, root.inspect
27
27
 
28
28
  if subfield and root.is_a?(Array)
29
29
  root.each do |r|
30
- if r.is_a?(Hash) and r[subfield] and ( (subvalue && r[subfield].to_s == subvalue) || true)
30
+ if r.is_a?(Hash) and r[subfield.to_sym] and ( (subvalue && r[subfield.to_sym].to_s == subvalue) || true)
31
31
  root = r
32
32
  break
33
33
  end
@@ -48,12 +48,12 @@ class Hash
48
48
  root = self
49
49
 
50
50
  path[0..-2].each do |p|
51
- root[p] = {} unless root[p].is_a?(Hash)
52
- root = root[p]
51
+ root[p.to_sym] = {} unless root[p.to_sym].is_a?(Hash)
52
+ root = root[p.to_sym]
53
53
  end
54
54
 
55
55
  if value
56
- root[path.last] = value
56
+ root[path.last.to_sym] = value
57
57
  else
58
58
  root.reject!{|k,v| k.to_sym == path.last.to_sym }
59
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: