nested_objects 0.1.16 → 0.1.18
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/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +15 -0
- data/README.md +34 -45
- data/lib/nested_objects/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b66e6f931bd1c3210be80d713fe4496620b09f8182c5933552fc698aae03f67a
|
|
4
|
+
data.tar.gz: de45fbee0beecf353d08c46063f93ac97535c1f3f839897ad9e58b97fc7f3fa8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d65e4dfa7a9c77122e67b0ba7be8c024e774d332bae191a4003e51a30be4a471cf9a6454913f4f2f8cf5b275621fac3726a8e9fe18fa0e098b207ff0d1091c0c
|
|
7
|
+
data.tar.gz: 0a2531ee5d534f442f94d70ee23ad4f0a1386da8895619b924db8e24bc302b9f01a308e7f302b2f3f661f4e6ff22b0b5e89b38a65ca8349da04ae27c24d4e160
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.18](https://github.com/main-branch/nested_objects/compare/v0.1.17...v0.1.18) (2026-04-24)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Other Changes
|
|
7
|
+
|
|
8
|
+
* Correct syntax error in example data and improve formatting in README ([64dc3b9](https://github.com/main-branch/nested_objects/commit/64dc3b9e804c801733d003c0c7eb54af3f644786))
|
|
9
|
+
* **dependencies:** Update dependencies for all GitHub Actions workflows ([ead4d20](https://github.com/main-branch/nested_objects/commit/ead4d2054bdc65bbf6d39559d69612463466d041))
|
|
10
|
+
|
|
11
|
+
## [0.1.17](https://github.com/main-branch/nested_objects/compare/v0.1.16...v0.1.17) (2025-04-27)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Other Changes
|
|
15
|
+
|
|
16
|
+
* Update online yardoc links and simplify readme ([5777d3e](https://github.com/main-branch/nested_objects/commit/5777d3e6a643d3d14c05b1b699a20b0f9fdebebd))
|
|
17
|
+
|
|
3
18
|
## [0.1.16](https://github.com/main-branch/nested_objects/compare/v0.1.15...v0.1.16) (2025-04-27)
|
|
4
19
|
|
|
5
20
|
|
data/README.md
CHANGED
|
@@ -2,72 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/nested_objects)
|
|
4
4
|
[](https://github.com/main-branch/nested_objects/actions/workflows/continuous_integration.yml)
|
|
5
|
-
[](https://
|
|
5
|
+
[](https://gemdocs.org/gems/nested_objects)
|
|
6
6
|
[](https://rubydoc.info/gems/nested_objects/file/CHANGELOG.md)
|
|
7
7
|
[](https://main-branch.slack.com/archives/C01CHR7TMM2)
|
|
8
8
|
|
|
9
|
-
The `NestedObjects` module provides module
|
|
9
|
+
The `NestedObjects` module provides module methods to safely navigate and
|
|
10
10
|
manage a heirarchy of Ruby POROs nested using Hashes or Arrays. Think of these
|
|
11
11
|
nested data objects like what you would get after reading in a JSON file.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Usage
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
values and array elements
|
|
17
|
-
* `NestedObjects.dig(data, path)` - returns the value at the given path
|
|
18
|
-
* `NestedObjects.bury(data, path, value)` - sets a value within the data structure at
|
|
19
|
-
the given path
|
|
20
|
-
* `NestedObjects.delete(data, path)` - deletes the Hash key or Array index at the
|
|
21
|
-
given path
|
|
22
|
-
* `NestedObjects.path?(data, path)` - returns true if the path exists in the given
|
|
23
|
-
data structure
|
|
15
|
+
### Module Methods
|
|
24
16
|
|
|
25
|
-
These methods
|
|
26
|
-
`
|
|
17
|
+
These methods are exposted on the `NestedObjects` module. The key methods are:
|
|
18
|
+
`deep_copy`, `dig`, `bury`, `delete`, and `path?`.
|
|
27
19
|
|
|
28
|
-
|
|
29
|
-
Object.include NestedObjects::Mixin
|
|
20
|
+
Here is an example of using the `dig` method:
|
|
30
21
|
|
|
31
|
-
|
|
22
|
+
```Ruby
|
|
23
|
+
require 'nested_objects'
|
|
32
24
|
|
|
33
|
-
data
|
|
25
|
+
data = { 'people' => [{ 'name' => 'John'}, { 'name' => 'Jane' }] }
|
|
26
|
+
path = 'people/0/name'.split('/')
|
|
27
|
+
NestedObjects.dig(data, path) #=> 'John'
|
|
34
28
|
```
|
|
35
29
|
|
|
36
|
-
|
|
30
|
+
See documentation and examples of the full API in
|
|
31
|
+
[the gem's YARD documentation](https://gemdocs.org/gems/nested_objects/).
|
|
37
32
|
|
|
38
|
-
|
|
33
|
+
### Object Mixin
|
|
39
34
|
|
|
40
|
-
|
|
41
|
-
`
|
|
42
|
-
|
|
43
|
-
For experimentation, you can also run `bin/console` for an interactive (IRB) prompt that
|
|
44
|
-
automatically requires nested_objects.
|
|
45
|
-
|
|
46
|
-
## Contributing
|
|
35
|
+
As a convenience, these methods can be mixed into other classes by including the
|
|
36
|
+
`NestedObjects::Mixin` module.
|
|
47
37
|
|
|
48
|
-
|
|
38
|
+
In order to reduce the possibility of method name conflicts, all methods are prefixed
|
|
39
|
+
with `nested_`.
|
|
49
40
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
All commit messages must follow the [Conventional Commits
|
|
53
|
-
standard](https://www.conventionalcommits.org/en/v1.0.0/). This helps us maintain a
|
|
54
|
-
clear and structured commit history, automate versioning, and generate changelogs
|
|
55
|
-
effectively.
|
|
41
|
+
```Ruby
|
|
42
|
+
require 'nested_objects'
|
|
56
43
|
|
|
57
|
-
|
|
44
|
+
Object.include NestedObjects::Mixin
|
|
58
45
|
|
|
59
|
-
|
|
46
|
+
data = { 'people' => [{ 'name' => 'John'}, { 'name' => 'Jane' }] }
|
|
47
|
+
path = 'people/0/name'.split('/')
|
|
48
|
+
data.nested_dig(path) #=> 'John'
|
|
49
|
+
```
|
|
60
50
|
|
|
61
|
-
|
|
51
|
+
## Development
|
|
62
52
|
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
54
|
+
`bundle exec rake` to run tests, static analysis, and build the gem.
|
|
65
55
|
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
For experimentation, you can also run `bin/console` for an interactive (IRB) prompt
|
|
57
|
+
that automatically requires nested_objects.
|
|
68
58
|
|
|
69
|
-
|
|
59
|
+
## Contributing
|
|
70
60
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
history clean and meaningful.
|
|
61
|
+
See [the contributing guildlines](CONTRIBUTING.md) for guidance on how to contriute
|
|
62
|
+
to this project.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nested_objects
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Couball
|
|
@@ -218,8 +218,8 @@ metadata:
|
|
|
218
218
|
allowed_push_host: https://rubygems.org
|
|
219
219
|
homepage_uri: https://github.com/main-branch/nested_objects
|
|
220
220
|
source_code_uri: https://github.com/main-branch/nested_objects
|
|
221
|
-
documentation_uri: https://
|
|
222
|
-
changelog_uri: https://
|
|
221
|
+
documentation_uri: https://gemdocs.org/nested_objects/0.1.18
|
|
222
|
+
changelog_uri: https://gemdocs.org/nested_objects/0.1.18/file.CHANGELOG.md
|
|
223
223
|
rubygems_mfa_required: 'true'
|
|
224
224
|
rdoc_options: []
|
|
225
225
|
require_paths:
|
|
@@ -237,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
237
237
|
requirements:
|
|
238
238
|
- 'Platform: Mac, Linux, or Windows'
|
|
239
239
|
- 'Ruby: MRI 3.1 or later, TruffleRuby 24 or later, or JRuby 9.4 or later'
|
|
240
|
-
rubygems_version:
|
|
240
|
+
rubygems_version: 4.0.6
|
|
241
241
|
specification_version: 4
|
|
242
242
|
summary: Utilities for working with PORO structures arbitrarily nested with Hashes
|
|
243
243
|
and Arrays
|