hash_ext 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -5
- data/lib/hash_ext/normalized.rb +5 -4
- data/lib/hash_ext/version.rb +1 -1
- metadata +2 -4
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4eb2208c7445ed318154e7356194a5df58cf78a6
|
4
|
+
data.tar.gz: 4a8535a3b5269911a344a7374a31e9bb14a98fa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32c0e85a844b0c7427b2f57885ed6a8edc8f30b1ab61c0b4193ccfbc9e00bd1beda417a28947043f1f712b6763e5be476f7fe9c12121d3e22e3045afee17d58c
|
7
|
+
data.tar.gz: 0698afb6f8c2a669e51dd02735885a9ee1767c21e1556dc0f21b05bc40cd944742c29f607ccb6cc7ef631c42622b599ef6b7fd70a688c4fb2ec31f30a2c1e4c5
|
data/README.md
CHANGED
@@ -92,11 +92,6 @@ hash[:a] = 3
|
|
92
92
|
hash.keys # => [:a, :b, :c]
|
93
93
|
```
|
94
94
|
|
95
|
-
## Development
|
96
|
-
|
97
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
98
|
-
|
99
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
100
95
|
|
101
96
|
## Contributing
|
102
97
|
|
data/lib/hash_ext/normalized.rb
CHANGED
@@ -27,16 +27,17 @@ class Hash
|
|
27
27
|
super normalize_key(key)
|
28
28
|
end
|
29
29
|
|
30
|
-
def update(hash)
|
30
|
+
def update(hash, &block)
|
31
31
|
hash.each do |key, value|
|
32
|
-
|
32
|
+
new_val = block && key?(key) ? block.call(key, self[key], value) : value
|
33
|
+
store normalize_key(key), normalize_value(new_val)
|
33
34
|
end
|
34
35
|
self
|
35
36
|
end
|
36
37
|
alias_method :merge!, :update
|
37
38
|
|
38
|
-
def merge(hash)
|
39
|
-
dup.update hash
|
39
|
+
def merge(hash, &block)
|
40
|
+
dup.update hash, &block
|
40
41
|
end
|
41
42
|
|
42
43
|
def key?(key)
|
data/lib/hash_ext/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash_ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Naiman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -124,8 +124,6 @@ files:
|
|
124
124
|
- LICENSE.txt
|
125
125
|
- README.md
|
126
126
|
- Rakefile
|
127
|
-
- bin/console
|
128
|
-
- bin/setup
|
129
127
|
- hash_ext.gemspec
|
130
128
|
- lib/hash_ext.rb
|
131
129
|
- lib/hash_ext/accessible.rb
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "hash_ext"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|