hash_map 0.6.1 → 0.6.2

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
  SHA256:
3
- metadata.gz: dc971280a4ffad89cb9b4f93132e673eae4412558bb5bde8e3f3748873c67f7f
4
- data.tar.gz: '060278780641e8248af95dcd7cacd7d222f7a4bdc2f5b5f522b030c35a0433fa'
3
+ metadata.gz: d9fe3302f75b5cbae0c9e92deea5a40ec0aa4c240a94163077bed367534eda01
4
+ data.tar.gz: aa5d13b00571b3aa7d4010df835d19216dc08eeafb881ef5488683f950a582d0
5
5
  SHA512:
6
- metadata.gz: 44801fbd00a2c195e8583b977f8145d2552df02a361aab725d4677d7e5e4bbdfb551daba17d501fadb5995f354d89a05100d95002c78aa344746b2a05df2da0f
7
- data.tar.gz: 3a4850f7da85c482f3d912913367b6c22389496fb11364c788402a00c97dfe6c96429a78fd84fc573bbb555fe0e7ead0666d6228551f03a2ad2f3f91b8a941f0
6
+ metadata.gz: 9b1ad0e01f06bf40c444389490d0d639f5acae3385259ef1350a5efff5503a03bb2337d70ca2b3989c452a476873fca95bbe9a0013042dbd21ded764258d10b0
7
+ data.tar.gz: fe46e5d74f3388c75f2be15e49521b852108260e10bb4aac9909a7386a50e46f1a55c2826c2ab1e9ca87bc05d3e30ec653b4038ca450da1c9e46207083a6ae29
data/README.md CHANGED
@@ -365,7 +365,7 @@ AfterEach.call(booleans)
365
365
  #=> {"name"=>true, "age"=>false}
366
366
  ```
367
367
 
368
- ### `only_provided_keys`
368
+ ### `only_provided_keys`, `only_provided_call`
369
369
 
370
370
  ```ruby
371
371
  class RegularMapper < HashMap::Base
@@ -385,6 +385,12 @@ RegularMapper.call(input) # => {"name"=>"john", "lastname"=>nil, "phone"=>nil, "
385
385
  OnlyProvidedKeysMapper.call(input) # => {"name"=>"john", phone: nil, "address"=>{"street"=>"Batu Mejan"}}
386
386
  ```
387
387
 
388
+ You can use a `only_provided_call` instead of call if you want to achieve the same result:
389
+
390
+ ```ruby
391
+ RegularMapper.only_provided_call(input) # => {"name"=>"john", phone: nil, "address"=>{"street"=>"Batu Mejan"}}
392
+ ```
393
+
388
394
  ### JSON Adapter
389
395
  ```ruby
390
396
  class UserMapper < HashMap::Base
@@ -14,6 +14,12 @@ module HashMap
14
14
  end
15
15
  end
16
16
 
17
+ def self.only_provided_call(*args)
18
+ Class.new(self) do
19
+ only_provided_keys
20
+ end.call(*args)
21
+ end
22
+
17
23
  attr_reader :original, :options
18
24
  def initialize(original, options = {})
19
25
  @original = _transforms_input(prepare_input(original))
@@ -1,3 +1,3 @@
1
1
  module HashMap
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash_map
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artur Pañach