everythingrb 0.1.2 → 0.2.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/CHANGELOG.md +38 -1
- data/README.md +54 -6
- data/flake.nix +2 -2
- data/lib/everythingrb/core/hash.rb +16 -19
- data/lib/everythingrb/core/string.rb +11 -0
- data/lib/everythingrb/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81c7beca1a15139ecb5a59977740b65244d05f16b157ca45fb0d2995c7503bd3
|
4
|
+
data.tar.gz: d6b6fffa5d7be4890ac617b17c785e289e6e6f3385fa941a72f211f47e2a7c0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3089b90018085b856d7fd34a133ec9174753a371d7c6d56088c82fbbd5c46a1e5c4c3a2c0d9e967b1eaf28d84dd322b5b8a919a93bd5f71157e2638bdfaabfd
|
7
|
+
data.tar.gz: 5f5e058681ad88168d0a37c7580fd29483f755a895d0fce088e8db9904136d7a118d6b7557375fc7675f8b157da16b61274eeaf0378a53e53863632723dcccc0
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
<!--
|
8
9
|
## [Unreleased]
|
9
10
|
|
10
11
|
### Added
|
@@ -12,6 +13,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
12
13
|
### Changed
|
13
14
|
|
14
15
|
### Removed
|
16
|
+
-->
|
17
|
+
|
18
|
+
## [Unreleased]
|
19
|
+
|
20
|
+
### Added
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
|
24
|
+
### Removed
|
25
|
+
|
26
|
+
## [0.2.1] - 12025-03-01
|
27
|
+
|
28
|
+
### Added
|
29
|
+
|
30
|
+
- Added `with_quotes` / `in_quotes` to `String`
|
31
|
+
|
32
|
+
### Removed
|
33
|
+
|
34
|
+
- Removed `Data` definition check for `to_istruct`
|
35
|
+
|
36
|
+
|
37
|
+
## [0.2.0] - 12025-02-17
|
38
|
+
|
39
|
+
### Added
|
40
|
+
|
41
|
+
- Added Ruby version test matrix
|
42
|
+
|
43
|
+
### Changed
|
44
|
+
|
45
|
+
- Updated `flake.nix` to use 3.4
|
46
|
+
|
47
|
+
### Removed
|
48
|
+
|
49
|
+
- Removed Ruby 3.1 support
|
15
50
|
|
16
51
|
## [0.1.2] - 12025-02-11
|
17
52
|
|
@@ -53,7 +88,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
53
88
|
|
54
89
|
- Added alias `each` to `each_pair` in OpenStruct for better enumerable compatibility
|
55
90
|
|
56
|
-
[unreleased]: https://github.com/itsthedevman/everythingrb/compare/v0.1
|
91
|
+
[unreleased]: https://github.com/itsthedevman/everythingrb/compare/v0.2.1...HEAD
|
92
|
+
[0.2.1]: https://github.com/itsthedevman/everythingrb/compare/v0.2.0...v0.2.1
|
93
|
+
[0.2.0]: https://github.com/itsthedevman/everythingrb/compare/v0.1.2...v0.2.0
|
57
94
|
[0.1.2]: https://github.com/itsthedevman/everythingrb/compare/v0.1.1...v0.1.2
|
58
95
|
[0.1.1]: https://github.com/itsthedevman/everythingrb/compare/v0.1.0...v0.1.1
|
59
96
|
[0.1.0]: https://github.com/itsthedevman/everythingrb/compare/5870052e137cb430d084eab1ec3934f3c50b4501...v0.1.0
|
data/README.md
CHANGED
@@ -1,11 +1,56 @@
|
|
1
1
|
# EverythingRB
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/everythingrb)
|
4
|
+

|
4
5
|
[](https://github.com/everythingrb/sortsmith/actions/workflows/main.yml)
|
5
|
-

|
6
6
|
|
7
7
|
Useful extensions to Ruby core classes that you never knew you needed until now.
|
8
8
|
|
9
|
+
## Looking for a Software Engineer?
|
10
|
+
|
11
|
+
I'm currently looking for opportunities where I can tackle meaningful problems and help build reliable software while mentoring the next generation of developers. If you're looking for a senior engineer with full-stack Rails expertise and a passion for clean, maintainable code, let's talk!
|
12
|
+
|
13
|
+
[bryan@itsthedevman.com](mailto:bryan@itsthedevman.com)
|
14
|
+
|
15
|
+
# Table of Contents
|
16
|
+
|
17
|
+
- [Compatibility](#compatibility)
|
18
|
+
- [Installation](#installation)
|
19
|
+
- [Core Extensions](#core-extensions)
|
20
|
+
- [Array](#array)
|
21
|
+
- [join_map](#join_map)
|
22
|
+
- [Hash](#hash)
|
23
|
+
- [to_struct](#to_struct)
|
24
|
+
- [to_ostruct](#to_ostruct)
|
25
|
+
- [to_istruct](#to_istruct)
|
26
|
+
- [join_map](#join_map-1)
|
27
|
+
- [Module](#module)
|
28
|
+
- [attr_predicate](#attr_predicate)
|
29
|
+
- [OpenStruct](#openstruct)
|
30
|
+
- [each](#each)
|
31
|
+
- [map](#map)
|
32
|
+
- [filter_map](#filter_map)
|
33
|
+
- [join_map](#join_map-2)
|
34
|
+
- [String](#string)
|
35
|
+
- [to_h / to_a](#to_h--to_a)
|
36
|
+
- [to_istruct](#to_istruct-1)
|
37
|
+
- [to_ostruct](#to_ostruct-1)
|
38
|
+
- [to_struct](#to_struct-1)
|
39
|
+
- [to_deep_h](#to_deep_h)
|
40
|
+
- [Requirements](#requirements)
|
41
|
+
- [Contributing](#contributing)
|
42
|
+
- [License](#license)
|
43
|
+
- [Changelog](#changelog)
|
44
|
+
- [Credits](#credits)
|
45
|
+
|
46
|
+
Also see: [API Documentation](https://itsthedevman.com/docs/everythingrb)
|
47
|
+
|
48
|
+
## Compatibility
|
49
|
+
|
50
|
+
Currently tested on:
|
51
|
+
- MRI Ruby 3.2+
|
52
|
+
- NixOS (see `flake.nix` for details)
|
53
|
+
|
9
54
|
## Installation
|
10
55
|
|
11
56
|
Add this line to your application's Gemfile:
|
@@ -62,7 +107,7 @@ config.config.api_key # => "secret"
|
|
62
107
|
```
|
63
108
|
|
64
109
|
#### `to_istruct`
|
65
|
-
Recursively converts a hash into an immutable Data structure
|
110
|
+
Recursively converts a hash into an immutable Data structure.
|
66
111
|
|
67
112
|
```ruby
|
68
113
|
hash = { person: { name: "Bob", age: 30 } }
|
@@ -152,7 +197,7 @@ Parses JSON string into a Ruby Hash or Array.
|
|
152
197
|
```
|
153
198
|
|
154
199
|
#### `to_istruct`
|
155
|
-
Parses JSON string into an immutable Data structure
|
200
|
+
Parses JSON string into an immutable Data structure.
|
156
201
|
|
157
202
|
```ruby
|
158
203
|
'{"user": {"name": "Alice"}}'.to_istruct
|
@@ -189,10 +234,13 @@ nested_json.to_deep_h
|
|
189
234
|
# => {users: [{name: "Alice", roles: ["admin", "user"]}]}
|
190
235
|
```
|
191
236
|
|
192
|
-
|
237
|
+
#### `with_quotes` / `in_quotes`
|
238
|
+
Wraps the string in double quotes
|
193
239
|
|
194
|
-
|
195
|
-
|
240
|
+
```ruby
|
241
|
+
"Hello World".with_quotes
|
242
|
+
# => "\"Hello World\""
|
243
|
+
```
|
196
244
|
|
197
245
|
## Contributing
|
198
246
|
|
data/flake.nix
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
description = "Ruby 3.
|
2
|
+
description = "Ruby 3.4 development environment";
|
3
3
|
|
4
4
|
inputs = {
|
5
5
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
@@ -14,7 +14,7 @@
|
|
14
14
|
{
|
15
15
|
devShells.default = pkgs.mkShell {
|
16
16
|
buildInputs = with pkgs; [
|
17
|
-
(
|
17
|
+
(ruby_3_4.override {
|
18
18
|
jemallocSupport = true;
|
19
19
|
docSupport = false;
|
20
20
|
})
|
@@ -26,27 +26,24 @@ class Hash
|
|
26
26
|
filter_map(&block).join(join_with)
|
27
27
|
end
|
28
28
|
|
29
|
-
#
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
else
|
44
|
-
input
|
45
|
-
end
|
29
|
+
#
|
30
|
+
# Converts hash to an immutable Data structure
|
31
|
+
#
|
32
|
+
# @return [Data]
|
33
|
+
#
|
34
|
+
def to_istruct
|
35
|
+
recurse = lambda do |input|
|
36
|
+
case input
|
37
|
+
when Hash
|
38
|
+
input.to_istruct
|
39
|
+
when Array
|
40
|
+
input.map(&recurse)
|
41
|
+
else
|
42
|
+
input
|
46
43
|
end
|
47
|
-
|
48
|
-
Data.define(*keys.map(&:to_sym)).new(*values.map { |value| recurse.call(value) })
|
49
44
|
end
|
45
|
+
|
46
|
+
Data.define(*keys.map(&:to_sym)).new(*values.map { |value| recurse.call(value) })
|
50
47
|
end
|
51
48
|
|
52
49
|
#
|
data/lib/everythingrb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: everythingrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ostruct
|
@@ -81,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
81
|
requirements:
|
82
82
|
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 3.
|
84
|
+
version: '3.2'
|
85
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|