gorilla-patch 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gorilla-patch/hash.rb +14 -5
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3abf5a91270b5321558fd3d1ab6de396fd29144
4
- data.tar.gz: ed75ce675f83b73a63d7ae6dd242110e01f5c517
3
+ metadata.gz: a787dd5c74b109548f43bb4bd596e8a3636ca8bd
4
+ data.tar.gz: dc6bca77019542a8123c4b9886b78bc3ce6f7599
5
5
  SHA512:
6
- metadata.gz: 947bf368b79766633538bf82b427a22b364a4acbb27b887d1da0f3fa5146c3849be332d8f8dde04d1ebe99c122b794304e57278de12fbf6f5c983d935be0975c
7
- data.tar.gz: 46252a7a0e9ca9a135437aa718695fd58f425313d859be6810c1e2f22e1a43eefdc15d1fbaae9688053344efc8f1e46e6841df194d04dc766f8c53cd25566f0e
6
+ metadata.gz: c95104711ff03680d77866e9dcabcc47040f6ec385dc48894af6ab39e49532ba7ed2bd75c48ace8bbc95431230e0680c0001db37a64804ef7550fc90d91e8405
7
+ data.tar.gz: ed84ec1f229035b0c213c0a39917b39a12a3a69a4738553da48349cb7e4fab590b3d89e8294fe771c00a775de2207c052caf1146b3747ca274b0943b431d4113
@@ -4,24 +4,33 @@ module GorillaPatch
4
4
  refine Hash do
5
5
 
6
6
  def keys_to_sym
7
- inject({}) { | hash_sym, (key, val) | hash_sym[key.to_sym] = val; hash_sym }
7
+ each_with_object({}) { |(key, val), hash_sym| hash_sym[key.to_sym] = val }
8
8
  end
9
9
 
10
10
  def keys_to_sym!
11
11
  hash_sym = keys_to_sym
12
- self.clear.merge! hash_sym
12
+ clear.merge! hash_sym
13
13
  end
14
14
 
15
15
  def keys_to_s
16
- inject({}) { | hash_s, (key, val) | hash_s[key.to_s] = val; hash_s }
16
+ each_with_object({}) { |(key, val), hash_s| hash_s[key.to_s] = val }
17
17
  end
18
18
 
19
19
  def keys_to_s!
20
20
  hash_s = keys_to_s
21
- self.clear.merge! hash_s
21
+ clear.merge! hash_s
22
+ end
23
+
24
+ def except(*keys)
25
+ dup.except!(*keys)
26
+ end
27
+
28
+ def except!(*keys)
29
+ keys.each { |key| delete(key) }
30
+ self
22
31
  end
23
32
 
24
33
  end
25
34
 
26
35
  end
27
- end
36
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorilla-patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Popov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-29 00:00:00.000000000 Z
11
+ date: 2015-09-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Refine Ruby Core classes.
14
14
  email: alex.wayfer@gmail.com
@@ -40,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
40
  version: '0'
41
41
  requirements: []
42
42
  rubyforge_project:
43
- rubygems_version: 2.4.5
43
+ rubygems_version: 2.4.5.1
44
44
  signing_key:
45
45
  specification_version: 4
46
46
  summary: Monkey patch, Core extensions