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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65fdcdef6f30c72fd67f580a85b229dc482436db
4
- data.tar.gz: 134b5b4bb3473bb91a70086944083d59bd863496
3
+ metadata.gz: 4eb2208c7445ed318154e7356194a5df58cf78a6
4
+ data.tar.gz: 4a8535a3b5269911a344a7374a31e9bb14a98fa2
5
5
  SHA512:
6
- metadata.gz: 922fc626a447c9d1a10630bec09f1276321e776b400e547ff867d054caf3662cb4799995fc6746a88047f3ed06570f72dbe00d846385741bbbe1b45923d09e4d
7
- data.tar.gz: 15d7e5d4a95549accc7328a6a091b1411431e26b5a401aa7b086d6310bf41aefafb6e2992449ddb4a28ffc82c5219ebdfe16a542591e6e5e56d0780323d52e85
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
 
@@ -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
- store normalize_key(key), normalize_value(value)
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)
@@ -1,3 +1,3 @@
1
1
  module HashExt
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
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.1
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-10-26 00:00:00.000000000 Z
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
@@ -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
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here