split_off 1.0.0

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 +7 -0
  2. data/lib/split_off.rb +8 -0
  3. metadata +73 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 13385699dd5b96b73ffc5b3b2c44f5d6cd639ead
4
+ data.tar.gz: 9222dd914f1618cb7311de3ea196b5214a1fdfd0
5
+ SHA512:
6
+ metadata.gz: b7a30e6f3a86eaaf34cd497847044b354dbb2505f766a5519fa5a3dd7ccec2dd67690327cf052dde4f2de9d081d0073c2f081795b95d6b313f13c8cef9af21e3
7
+ data.tar.gz: b45b754c7b7f2148629f865d1c7aa9caa1edbd8d73c68fd1928733b42dc0b6fac7f43d64fa6c0f97018de01501910c4d45ab3814d3e026ce614623466f1bf855
data/lib/split_off.rb ADDED
@@ -0,0 +1,8 @@
1
+ class Hash
2
+ def split_off!(*_keys)
3
+ _keys.reduce({}) do |result, _key|
4
+ result[_key] = self.delete(_key)
5
+ result
6
+ end.reject{|k, v| v.nil? }
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: split_off
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jan Renra Gloser
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description:
42
+ email:
43
+ - jan.renra.gloser@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/split_off.rb
49
+ homepage: https://github.com/renra/split-off-ruby
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 2.0.3
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: A method to split off a part a hash
73
+ test_files: []