dig_rb 1.0.0 → 1.0.1
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/.travis.yml +5 -1
- data/README.md +8 -4
- data/dig_rb.gemspec +2 -1
- data/lib/dig_rb/array.rb +2 -2
- data/lib/dig_rb/hash.rb +2 -2
- data/lib/dig_rb/ostruct.rb +2 -2
- data/lib/dig_rb/struct.rb +2 -3
- data/lib/dig_rb/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26a6f11a1284fe0e4021be42459a910b60f9fd96
|
4
|
+
data.tar.gz: bc90fba08f43ae321baaa80617e9754302165532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6451f94bfe7bb07964f47f80d760bd23c7e457ec94e9555662b4edd827e12d3415dab708c1f2e17edcffdaa4f2ecb91fb209cb696f73c9a13237e694a457ee1e
|
7
|
+
data.tar.gz: 802af9a9efb24dc898c4178c79ddc7e001ba3691592d7f7d7a41114f372961c35362a25f3087f3905a08ab27ff6a98c7a2696f769b2a7c9110da4260df7a8eb0
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
# Dig_rb
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/dig_rb) [](https://travis-ci.org/jrochkind/dig_rb)
|
4
|
+
|
3
5
|
[Ruby 2.3.0 introduced #dig on Hash, Array, and Struct](https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released/). With this gem, you can have dig on ruby pre 2.3.0, or any ruby lacking dig.
|
4
6
|
|
5
|
-
If you are writing an app and want to use dig in it you should probably just upgrade to ruby 2.3.0. But if you are writing a gem and want it to work with both MRI 2.3.0 and others, this gem is for you. This gem only adds #dig methods if they aren't already defined, so it's safe to use in code that is for all rubies, if run on MRI 2.3.0 you'll still be using native #dig, otherwise dig_rb's implementation.
|
7
|
+
If you are writing an app and want to use dig in it you should probably just upgrade to ruby 2.3.0. But if you are writing a gem and want it to work with both MRI 2.3.0 and others (including JRuby 9.0.x), this gem is for you. This gem only adds #dig methods if they aren't already defined, so it's safe to use in code that is for all rubies, if run on MRI 2.3.0 you'll still be using native #dig, otherwise dig_rb's implementation.
|
6
8
|
|
7
|
-
|
9
|
+
### Will it work identically to MRI 2.3.0 dig?
|
8
10
|
|
9
11
|
Dig_rb is tested with:
|
10
12
|
|
11
13
|
* Specs found in MRI repo for #dig in 2.3.0
|
12
14
|
* [Ruby Spec Suite](https://github.com/ruby/spec/) specs found in repo for Array and Hash#dig
|
13
|
-
* All examples in MRI 2.3.0 generated method API docs. (One example in MRI 2.3.0 is _wrong_ about exception class
|
15
|
+
* All examples in MRI 2.3.0 generated method API docs. (One example in MRI 2.3.0 is _wrong_ about exception class and message returned, dig_rb matches actual 2.3.0 behavior there, not documented example)
|
16
|
+
|
17
|
+
[Our travis](https://travis-ci.org/jrochkind/dig_rb) runs tests on a variety of ruby platforms.
|
14
18
|
|
15
19
|
If you find any weird edge cases that work differenty in MRI 2.3.0 than in ruby_dig, let me know in a GitHub Issue please.
|
16
20
|
|
@@ -50,7 +54,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
50
54
|
|
51
55
|
## Contributing
|
52
56
|
|
53
|
-
1. Fork it ( https://github.com/
|
57
|
+
1. Fork it ( https://github.com/jrochkind/dig_rb/fork )
|
54
58
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
59
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
60
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/dig_rb.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.9"
|
21
|
+
#spec.add_development_dependency "bundler", "~> 1.9"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "minitest", "~> 5.8.0"
|
23
24
|
end
|
data/lib/dig_rb/array.rb
CHANGED
data/lib/dig_rb/hash.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
unless Hash.
|
1
|
+
unless Hash.instance_methods.include?(:dig)
|
2
2
|
Hash.class_eval do
|
3
3
|
# Retrieves the value object corresponding to the each key objects repeatedly.
|
4
4
|
#
|
@@ -12,4 +12,4 @@ unless Hash.respond_to?(:dig)
|
|
12
12
|
value.dig(*args)
|
13
13
|
end
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
data/lib/dig_rb/ostruct.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'ostruct'
|
2
|
-
unless OpenStruct.
|
2
|
+
unless OpenStruct.instance_methods.include?(:dig)
|
3
3
|
OpenStruct.class_eval do
|
4
4
|
#
|
5
5
|
# Retrieves the value object corresponding to the each +name+
|
@@ -23,4 +23,4 @@ unless OpenStruct.respond_to?(:dig)
|
|
23
23
|
value.dig(*args)
|
24
24
|
end
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
data/lib/dig_rb/struct.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
unless Struct.respond_to?(:dig)
|
1
|
+
unless Struct.instance_methods.include?(:dig)
|
3
2
|
Struct.class_eval do
|
4
3
|
|
5
4
|
# Extracts the nested value specified by the sequence of <i>idx</i>
|
@@ -24,4 +23,4 @@ unless Struct.respond_to?(:dig)
|
|
24
23
|
value.dig(*args)
|
25
24
|
end
|
26
25
|
end
|
27
|
-
end
|
26
|
+
end
|
data/lib/dig_rb/version.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dig_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '10.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '10.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 5.8.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 5.8.0
|
41
41
|
description:
|
42
42
|
email:
|
43
43
|
- jonathan@dnil.net
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.5.1
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Array/Hash/Struct#dig backfill for ruby
|