respond_to_dig 1.1.0 → 1.2.0

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: 7093fc0a72916735cfa5a2e911152ad6564b8029
4
- data.tar.gz: d8d5fa0f6cc82c881caca196a30df4bcfb915090
3
+ metadata.gz: 767731e567059a3b6c0283578e3defb5e7381e42
4
+ data.tar.gz: e72e7b829b21bae7d30905f0947c8824a2a14f9c
5
5
  SHA512:
6
- metadata.gz: 3b9e60265b8f80a7066be6acc05e8194ba9cdbba5b935bc35366e1e452310d9d4a15b4ce38e033aee7a842aee0271bc73caa39c260f4856e939f7784b7a1adbf
7
- data.tar.gz: 77f95396978f600b84f0f3ed38432651d9942ee0c991ad0fb412f122514edae8a802a907714d647350089871c9b018543e08475bf3c55b8e0cfadf00ab2ab34e
6
+ metadata.gz: 54f6e62b0a949609948fa5413660b21e8e42aec81a1002adbcc95d15f4966e020fe7cb33677d4bab0e8588f8aa9ac91bb2e900770312d79cc1eb3c0700954f5a
7
+ data.tar.gz: ecbe31fb95877610f5f76264db20cbfa3b22badce7741005cc2088ea7918a780ca2f6988606b6086a090dda9459ba2c225f61cd73ec8d5ffa15d47b388795e42
@@ -1,6 +1,6 @@
1
1
  | Q | A
2
2
  | ------------- | ---
3
- | Branch? | "master" for new features / 1.0 for fixes
3
+ | Branch? | "master" for new features
4
4
  | Bug fix? | yes/no
5
5
  | New feature? | yes/no
6
6
  | BC breaks? | yes/no
data/README.md CHANGED
@@ -2,6 +2,7 @@ RespondToDig
2
2
  ===
3
3
 
4
4
  [![Build Status](https://travis-ci.org/announce/respond_to_dig.svg?branch=master)](https://travis-ci.org/announce/respond_to_dig)
5
+ [![Gem Version](https://badge.fury.io/rb/respond_to_dig.svg)](https://badge.fury.io/rb/respond_to_dig)
5
6
 
6
7
  This gem backports Array#dig and Hash#dig methods from Ruby 2.3+ to earlier versions of Ruby, only if you explicitly call it.
7
8
 
@@ -30,13 +31,13 @@ Or install it yourself as:
30
31
  ```rb
31
32
  require 'respond_to_dig'
32
33
 
33
- h = RespondToDig::respond_to_dig({ foo: {bar: {baz: 1 }}})
34
+ h = RespondToDig.invoke({ foo: {bar: {baz: 1 }}})
34
35
  h.dig(:foo, :bar, :baz) #=> 1
35
36
  h.dig(:foo, :zot, :xyz) #=> nil
36
37
  h.dig(:foo, :bar, :baz, :xyz) #=> TypeError
37
38
 
38
- g = RespondToDig::respond_to_dig({ foo: [10, 11, 12] })
39
+ g = RespondToDig.invoke({ foo: [10, 11, 12] })
39
40
  g.dig(:foo, 1) #=> 11
40
41
  ```
41
42
 
42
- For the details, refer [Module: RespondToDig — Documentation](http://www.rubydoc.info/gems/respond_to_dig/RespondToDig).
43
+ For the details, refer [Module: RespondToDig — Documentation](http://www.rubydoc.info/gems/respond_to_dig/1.2.0/RespondToDig).
@@ -1,12 +1,12 @@
1
1
  # Extracts the nested value specified by the sequence of index by calling dig at each step,
2
2
  # returning nil if any intermediate step is nil.
3
3
  # @example
4
- # h = RespondToDig::invoke_dig({ foo: {bar: {baz: 1 }}})
4
+ # h = RespondToDig.invoke({ foo: {bar: {baz: 1 }}})
5
5
  # h.dig(:foo, :bar, :baz) #=> 1
6
6
  # h.dig(:foo, :zot, :xyz) #=> nil
7
7
  # h.dig(:foo, :bar, :baz, :xyz) #=> TypeError
8
8
  #
9
- # g = RespondToDig::invoke_dig({ foo: [10, 11, 12] })
9
+ # g = RespondToDig.invoke({ foo: [10, 11, 12] })
10
10
  # g.dig(:foo, 1) #=> 11
11
11
  module RespondToDig
12
12
 
@@ -32,7 +32,9 @@ module RespondToDig
32
32
  not target.respond_to? :dig
33
33
  end
34
34
 
35
+ # @deprecated Please use {#invoke} instead
35
36
  alias_method :invoke_dig, :respond_to_dig
37
+ alias_method :invoke, :respond_to_dig
36
38
  end
37
39
 
38
40
  # Retrieves the value object corresponding to the each `key` objects recursively with nil-safe
@@ -40,7 +42,7 @@ module RespondToDig
40
42
  # @raise [TypeError] Throws if trying to access the value which doesn't respond to `#dig` such as `String` object
41
43
  # @return [Object, RespondToDig, NilClass]
42
44
  def dig(key, *rest)
43
- value = RespondToDig::respond_to_dig(self[key])
45
+ value = RespondToDig.invoke(self[key])
44
46
  if value.nil? || rest.empty?
45
47
  value
46
48
  elsif value.respond_to?(:dig)
@@ -1,3 +1,3 @@
1
1
  module RespondToDig
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
@@ -101,8 +101,11 @@ class RespondToDigTest
101
101
  end
102
102
 
103
103
  describe "Alias" do
104
- it 'alias #invoke_dig' do
105
- assert_equal RespondToDig::respond_to_dig({}), RespondToDig::invoke_dig({})
104
+ it 'alias #invoke' do
105
+ assert_equal RespondToDig.respond_to_dig({}), RespondToDig.invoke({})
106
+ end
107
+ it 'alias #invoke_dig (deprecated)' do
108
+ assert_equal RespondToDig.respond_to_dig({}), RespondToDig.invoke_dig({})
106
109
  end
107
110
  end
108
111
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: respond_to_dig
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ymkjp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-04 00:00:00.000000000 Z
11
+ date: 2016-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler