hash_order_helper 0.1.5 → 0.1.6

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
  SHA1:
3
- metadata.gz: fed8045b5b231e00e1742953907a8fe93a066ad7
4
- data.tar.gz: f4c57105accbd38c51f3836b867e43dc60861660
3
+ metadata.gz: f0ed60309ad0a91aa664725e5e727c2b9521a18a
4
+ data.tar.gz: 6416020a3396cfab63752cf0b4957ea8c0a8d2b2
5
5
  SHA512:
6
- metadata.gz: bc5b033d200678648b8a4644e8bf013d96e7775ed83e336c2e14b07cea972661eeece581899c350cdef33310e07462c51e77da8a37af4e9d35e9ea0bdeb4d92d
7
- data.tar.gz: e51b1881becb9f6d4c0781bf52d96bfa77844a021a1c65ab10f6199ecc5c823461880906c14b3c4f9644ac7f757f525c9a7392c7d1777dfe8142b5b972756773
6
+ metadata.gz: da8df1efeebf976c8b4aef15222c33bdf253e38b880d5b14e083066efac2ea34756a35d8b41d503d27a9ab5224c3151f5b29abefffd8424bb1fc26ef5774a766
7
+ data.tar.gz: d45e901e181fde9fde9500a5283e63d43377bace87008b4b4180833ebf852a5e698da83cda75f0975f097b43891e06a901eef2dcb2f76654a5db3a41d0e2e26c
data/README.md CHANGED
@@ -45,9 +45,9 @@ The following methods are added:
45
45
  * `last -> Array`
46
46
  * `last(n) -> Array`
47
47
  * `pop -> Array`
48
- * `pop(n) -> Array` (alias: `<<`)
48
+ * `pop(n) -> Array`
49
49
  * `nd_push(hash) -> Hash` **non-destructive** (alias: `+`)
50
- * `push(hash) -> Hash`
50
+ * `push(hash) -> Hash` (alias: `<<`)
51
51
  * `nd_unshift(hash) -> Hash` **non-destructive**
52
52
  * `unshift(hash) -> Hash`
53
53
  * `>>(receiver_hash) -> Hash`
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = 'hash_order_helper'
4
- spec.version = '0.1.5'
4
+ spec.version = '0.1.6'
5
5
  spec.authors = ['Genki Sugawara']
6
6
  spec.email = ['sugawara@cookpad.com']
7
7
 
@@ -32,6 +32,7 @@ module HashOrderHelper
32
32
  end
33
33
 
34
34
  def insert(nth, insert_hash)
35
+ insert_hash ||= {}
35
36
  hash_keys = self.keys
36
37
  hash_keys.insert(nth, *insert_hash.keys)
37
38
  new_hash = {}
@@ -66,6 +67,7 @@ module HashOrderHelper
66
67
  end
67
68
 
68
69
  def nd_push(push_hash)
70
+ push_hash ||= {}
69
71
  hash_keys = self.keys - push_hash.keys
70
72
  hash_keys.push(*push_hash.keys)
71
73
  new_hash = {}
@@ -85,6 +87,7 @@ module HashOrderHelper
85
87
  alias << push
86
88
 
87
89
  def nd_unshift(unshift_hash)
90
+ unshift_hash ||= {}
88
91
  hash_keys = self.keys - unshift_hash.keys
89
92
  hash_keys.unshift(*unshift_hash.keys)
90
93
  new_hash = {}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash_order_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-24 00:00:00.000000000 Z
11
+ date: 2017-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.4.5.1
93
+ rubygems_version: 2.5.2
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: Add methods to manipulate the order of the entries in the Hash object.