clean-hash 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21c29289e7cd2fa8015e4e907d8d45fa1a4bb478b90df685ae15e06bf0ac1352
4
- data.tar.gz: ab4aa36aa08a93f6f99df04bc8ca75869d95da16a3581b27d1d30e2b720b02b3
3
+ metadata.gz: 504ba0826c7c49fb67852d5727cee9c8eababa06ca8bfe16d549a1d2324635da
4
+ data.tar.gz: 73d2a4313ea7894e3c5e6a213c7795a9d55c0c1c4b212b47eb40589ddec92f1c
5
5
  SHA512:
6
- metadata.gz: 8ecd25fcb3136ad9d3d2bf49ce8ed89db6b64f62e631264da6f434b0f28946d2bfd93140884bdbb6b65dc2879752f9dffccd59ee02bd40c0605a797aa352ee08
7
- data.tar.gz: 87f8b6456eb82c6e366f803ba7a17702d49542cdc78058db21ce17777324fe7cda1f9f246a665ed5369f7314c1822718708f0611d3573b9015102cf6408f1370
6
+ metadata.gz: 8be703db8baadcf96226318759def32120eef6ba618e3eda2f995c96ba01e237fb3bb7939305b68113992d0ffac0b1b426d49e7c1188208ac0eac1ede74b96d7
7
+ data.tar.gz: 790cf981f6050241151116bd468ea69c947b9fa7d3ca497e7fe3b5d29e9f6a978069564c4d94d0c9bd0e129fba6593e1bf979762f61bed2b8447a524533cb29b
data/.version CHANGED
@@ -1 +1 @@
1
- 0.5.8
1
+ 0.5.9
@@ -25,11 +25,12 @@ class CleanHash
25
25
  end
26
26
 
27
27
  def delete key
28
- self[key].tap do |out|
29
- @data.delete(key)
30
- @data.delete(key.to_s)
31
- @data.delete(key.to_sym) if key.respond_to?(:to_sym)
32
- end
28
+ out = []
29
+ out.push @data.delete(key)
30
+ out.push @data.delete(key.to_s)
31
+ out.push @data.delete(key.to_sym) if key.respond_to?(:to_sym)
32
+ out.each { |el| return el unless el.nil? }
33
+ nil
33
34
  end
34
35
 
35
36
  def to_h
@@ -3,11 +3,11 @@ class CleanHash
3
3
  def []= key, value
4
4
  value = value.to_s if value.is_a?(Symbol)
5
5
 
6
- unless value.nil? || value.is_a?(Hash) || value.is_a?(Numeric) || value.is_a?(String)
7
- raise ArgumentError.new('Unsupported safe type: %s' % value.class)
6
+ for kind in [NilClass, Hash, Numeric, String, TrueClass, FalseClass]
7
+ return super if value.is_a?(kind)
8
8
  end
9
9
 
10
- super
10
+ raise ArgumentError.new('Unsupported safe type: %s' % value.class)
11
11
  end
12
12
  end
13
13
  end
@@ -7,11 +7,6 @@ class CleanHash
7
7
  super
8
8
  end
9
9
 
10
- def []= key, value
11
- _check_key_existance key
12
- super
13
- end
14
-
15
10
  private
16
11
 
17
12
  def _check_key_existance key
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clean-hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dino Reic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-17 00:00:00.000000000 Z
11
+ date: 2020-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -37,7 +37,6 @@ files:
37
37
  - "./lib/clean-hash/hash_pollute.rb"
38
38
  - "./lib/clean-hash/pollute.rb"
39
39
  - "./lib/clean-hash/types/indifferent_type.rb"
40
- - "./lib/clean-hash/types/micro_indifferent.rb"
41
40
  - "./lib/clean-hash/types/mutex_type.rb"
42
41
  - "./lib/clean-hash/types/safe_type.rb"
43
42
  - "./lib/clean-hash/types/strict_type.rb"
@@ -1,10 +0,0 @@
1
- # class Indifferent < Hash
2
- # def [] key
3
- # out = super key.to_sym
4
- # out.class == Hash ? Indifferent.new.merge(out) : out
5
- # end
6
-
7
- # def []= key, value
8
- # super key.to_sym, value
9
- # end
10
- # end