darthjee-core_ext 3.1.0 → 3.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 +4 -4
- data/.circleci/config.yml +4 -5
- data/.claude/agents/architect.md +41 -0
- data/.claude/agents/legacy.md +19 -0
- data/.claude/agents/ruby.md +31 -0
- data/.claude/agents/security.md +22 -0
- data/.claude/configuration/arcanum-repo-config.json +3 -0
- data/.claude/scripts/check_ruby.sh +8 -0
- data/.claude/settings.json +10 -0
- data/.github/commit_message_template-2.0.md +32 -0
- data/.github/commit_message_template.md +10 -0
- data/.github/copilot-instructions.md +1 -99
- data/.github/pull_request_template.md +17 -0
- data/.gitignore +1 -0
- data/AGENTS.md +113 -0
- data/CLAUDE.md +1 -0
- data/Dockerfile +2 -2
- data/Gemfile +9 -9
- data/README.md +3 -3
- data/core_ext.jpg +0 -0
- data/docker-compose.yml +1 -1
- data/docs/agents/arcanum-split-issue.md +9 -0
- data/docs/agents/architecture.md +33 -0
- data/docs/agents/contributing.md +123 -0
- data/docs/agents/folder-structure.md +17 -0
- data/docs/agents/issue-enhancement.md +11 -0
- data/docs/agents/issues/.gitkeep +1 -0
- data/docs/agents/plans/.gitkeep +1 -0
- data/lib/darthjee/core_ext/version.rb +1 -1
- data/scripts/bump_version.sh +62 -0
- data/spec/integration/readme/hash_spec.rb +2 -4
- data/spec/integration/yard/darthjee/core_ext/hash/changeable_spec.rb +2 -2
- data/spec/integration/yard/darthjee/core_ext/hash/value_changer_spec.rb +1 -1
- data/spec/integration/yard/darthjee/core_ext/object_spec.rb +1 -2
- data/spec/lib/darthjee/core_ext/hash/value_changer_spec.rb +8 -8
- data/spec/lib/object_spec.rb +1 -2
- metadata +23 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2be51d5f98eb56eb38bbe096f1df08ddf10b32eead8c106a4bdf3f565705f54c
|
|
4
|
+
data.tar.gz: 8f01466a2c6e5bddc66b3a0a3e1f0faf5bd843da49e93bf1da099fc11eae2219
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91f1ff57e0908357695e5e4cadd69cc3f49711d39df0971e4c7b61144efebad69f423221093ecea4d9c4821a333481e6229bf80939d39a6c0a5ac7c904411c1b
|
|
7
|
+
data.tar.gz: 95ce069229e486ba050b54e9239201ebf43a045fee4f197482cce5008cce900f7f63a74d8cf4005a1341ac9f8fc0117dc958ad9b02c1b49cbcff3de97abbb08b
|
data/.circleci/config.yml
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
version: 2
|
|
1
|
+
version: 2.1
|
|
2
2
|
workflows:
|
|
3
|
-
version: 2
|
|
4
3
|
test-and-build:
|
|
5
4
|
jobs:
|
|
6
5
|
- test:
|
|
@@ -22,7 +21,7 @@ workflows:
|
|
|
22
21
|
jobs:
|
|
23
22
|
test:
|
|
24
23
|
docker:
|
|
25
|
-
- image: darthjee/
|
|
24
|
+
- image: darthjee/circleci_ruby_3412:1.0.0
|
|
26
25
|
environment:
|
|
27
26
|
PROJECT: core_ext
|
|
28
27
|
steps:
|
|
@@ -38,7 +37,7 @@ jobs:
|
|
|
38
37
|
command: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage/lcov/project.lcov
|
|
39
38
|
checks:
|
|
40
39
|
docker:
|
|
41
|
-
- image: darthjee/
|
|
40
|
+
- image: darthjee/circleci_ruby_3412:1.0.0
|
|
42
41
|
environment:
|
|
43
42
|
PROJECT: core_ext
|
|
44
43
|
steps:
|
|
@@ -63,7 +62,7 @@ jobs:
|
|
|
63
62
|
command: check_specs
|
|
64
63
|
build-and-release:
|
|
65
64
|
docker:
|
|
66
|
-
- image: darthjee/
|
|
65
|
+
- image: darthjee/circleci_ruby_3412:1.0.0
|
|
67
66
|
environment:
|
|
68
67
|
PROJECT: core_ext
|
|
69
68
|
steps:
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architect
|
|
3
|
+
description: core_ext architect and coordinator. Use for cross-cutting tasks, multi-agent coordination, documentation, root-level files, or any task that spans more than one agent's scope.
|
|
4
|
+
tools: Read, Edit, Write, Bash, Agent
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the architect and coordinator for core_ext, a Ruby gem (`darthjee-core_ext`) that adds methods to Ruby core classes.
|
|
8
|
+
|
|
9
|
+
## Your scope
|
|
10
|
+
|
|
11
|
+
- `docs/agents/`
|
|
12
|
+
- Root-level files: README.md, *_README.md, AGENTS.md, CLAUDE.md, gemspec, Gemfile, Dockerfile, docker-compose.yml, Makefile
|
|
13
|
+
- Cross-cutting decisions and coordination of the specialists
|
|
14
|
+
|
|
15
|
+
## Specialist agents
|
|
16
|
+
|
|
17
|
+
Delegate implementation, exploration and review to the right agent.
|
|
18
|
+
|
|
19
|
+
| Agent | Scope |
|
|
20
|
+
|-------|-------|
|
|
21
|
+
| `ruby` | `lib/`, `spec/`, `config/`, `scripts/`: implementation, tests, YARD docs |
|
|
22
|
+
| `security` | Read-only review of `lib/` for exploitable code |
|
|
23
|
+
| `legacy` | Read-only review of `lib/` for extensions that Ruby already provides |
|
|
24
|
+
|
|
25
|
+
## How to coordinate
|
|
26
|
+
|
|
27
|
+
1. Break the task down by agent.
|
|
28
|
+
2. Delegate exploration first.
|
|
29
|
+
3. Run independent agents in parallel, dependent ones in sequence.
|
|
30
|
+
4. For new or changed extensions, dispatch `security` and `legacy` to review after `ruby` implements.
|
|
31
|
+
5. Update `docs/agents/` after any architectural change.
|
|
32
|
+
|
|
33
|
+
## Documentation (`docs/agents/`)
|
|
34
|
+
|
|
35
|
+
| Document | Description |
|
|
36
|
+
|----------|-------------|
|
|
37
|
+
| `folder-structure.md` | Top-level directory layout |
|
|
38
|
+
| `architecture.md` | Source layout and design |
|
|
39
|
+
| `contributing.md` | Commit, PR and code-organization rules |
|
|
40
|
+
|
|
41
|
+
Keep them and AGENTS.md in sync when scopes change.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legacy
|
|
3
|
+
description: core_ext legacy reviewer. Use to find extensions that are deprecated or redundant because Ruby (or the stdlib) already provides an equivalent.
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the legacy reviewer for core_ext. You are read-only: report findings, never edit files.
|
|
8
|
+
|
|
9
|
+
## Your scope
|
|
10
|
+
|
|
11
|
+
Compare every method in `lib/darthjee/core_ext/` with the Ruby versions the gem supports (see gemspec and CI image) and look for:
|
|
12
|
+
|
|
13
|
+
- Methods now built in (`Hash#transform_keys`, `Hash#to_h` with a block, `Array#sum`, `Enumerable#each_with_object`/`tally`/`filter_map`, `Hash#dig`, and similar)
|
|
14
|
+
- Methods that only wrap a single built-in call
|
|
15
|
+
- Extensions whose behaviour differs from the built-in, which is a compatibility risk
|
|
16
|
+
|
|
17
|
+
## Report format
|
|
18
|
+
|
|
19
|
+
Per method: file:line, the Ruby equivalent and since which version, whether behaviour is identical (note differences), and a recommendation (deprecate, keep as alias, or keep). Test with `ruby -e` where unsure.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ruby
|
|
3
|
+
description: core_ext Ruby specialist. Use for any task involving Ruby code, RSpec specs, YARD docs, Rubocop, or gem tooling under lib/, spec/, config/ and scripts/.
|
|
4
|
+
tools: Read, Edit, Write, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the Ruby specialist for core_ext, a gem that adds methods to Ruby core classes.
|
|
8
|
+
|
|
9
|
+
## Your scope
|
|
10
|
+
|
|
11
|
+
You own `lib/`, `spec/`, `config/` and `scripts/`. Do NOT touch `docs/agents/` or root-level docs and packaging files.
|
|
12
|
+
|
|
13
|
+
## Stack
|
|
14
|
+
|
|
15
|
+
Ruby 3.3, RSpec, Rubocop, Yardstick/YARD, RubyCritic, Reek.
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bundle exec rspec
|
|
21
|
+
bundle exec rubocop
|
|
22
|
+
bundle exec rake verify_measurements
|
|
23
|
+
check_specs
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Conventions
|
|
27
|
+
|
|
28
|
+
- English everywhere; every public method has YARD docs with an @example
|
|
29
|
+
- Every feature or fix has specs mirroring `lib/` under `spec/lib/`
|
|
30
|
+
- Single responsibility, small methods, Law of Demeter; collaborators go in `lib/darthjee/core_ext/<class>/`
|
|
31
|
+
- Never add files to `config/check_specs.yml` just to skip tests
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security
|
|
3
|
+
description: core_ext security reviewer. Use to check new or changed code for possible exploitation (code injection, unsafe metaprogramming, ReDoS, unsafe deserialization, unsafe core overrides).
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the security reviewer for core_ext. You are read-only: report findings, never edit files.
|
|
8
|
+
|
|
9
|
+
## Your scope
|
|
10
|
+
|
|
11
|
+
Review `lib/` (and `spec/` only for context). Look for:
|
|
12
|
+
|
|
13
|
+
- `eval`, `instance_eval`/`class_eval` on strings, `send`/`public_send`/`const_get` with caller-controlled input
|
|
14
|
+
- Shell or file access (`system`, backticks, `open`, `File`) and unsafe deserialization (`Marshal.load`, `YAML.load`)
|
|
15
|
+
- Regexes prone to ReDoS
|
|
16
|
+
- Monkey-patches that change the semantics or visibility of existing core methods, or leak state
|
|
17
|
+
- Unbounded recursion or memory growth on hostile input (deep or huge hashes and arrays)
|
|
18
|
+
- Vulnerable dependencies (`bundle exec bundler-audit` if available)
|
|
19
|
+
|
|
20
|
+
## Report format
|
|
21
|
+
|
|
22
|
+
Per finding: file:line, severity, exploit scenario, suggested fix. Say explicitly when nothing was found.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
```text
|
|
2
|
+
<type>(<scope>): <subject> (issue #<id>)
|
|
3
|
+
|
|
4
|
+
<optional body: what was done and why, if not obvious>
|
|
5
|
+
|
|
6
|
+
Addresses-Comment: <optional: URL of the PR comment this commit addresses>
|
|
7
|
+
|
|
8
|
+
Co-Authored-By: <AI model name> <AI model email>
|
|
9
|
+
Co-Authored-By: <agent> agent <agent email>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Note: unlike the model line above (always the running AI model's own
|
|
13
|
+
canonical noreply address), the agent line's email is independently
|
|
14
|
+
configurable per agent via the "git.email" key (a template such as
|
|
15
|
+
"you+{agent}@example.com", with "{agent}" substituted for the actual
|
|
16
|
+
agent name, e.g. "architect" or "backend") in
|
|
17
|
+
.claude/state/arcanum-config.json (local) or
|
|
18
|
+
.claude/configuration/arcanum-repo-config.json (repo) — see
|
|
19
|
+
docs/guides/arcanum-repo-config.md. When "git.email" is unset, the agent
|
|
20
|
+
line falls back to the same address as the model line, reproducing the
|
|
21
|
+
old, single-shared-email template's output.
|
|
22
|
+
|
|
23
|
+
The model line above can be omitted entirely by setting the
|
|
24
|
+
"git.omit_model_coauthor" key to "true" in the same three locations
|
|
25
|
+
(local state, repo config, or global config — see
|
|
26
|
+
docs/guides/arcanum-repo-config.md) — the agent line is always still
|
|
27
|
+
emitted regardless of this setting.
|
|
28
|
+
|
|
29
|
+
This file's mere presence (as "commit_message_template-2.0.md", not its
|
|
30
|
+
content) is what switches the commit scripts onto this new, two-distinct-
|
|
31
|
+
email behavior — the content itself is never parsed at runtime, it is
|
|
32
|
+
purely human-facing documentation of the shape above.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
```text
|
|
2
|
+
<type>(<scope>): <subject> (issue #<id>)
|
|
3
|
+
|
|
4
|
+
<optional body: what was done and why, if not obvious>
|
|
5
|
+
|
|
6
|
+
Addresses-Comment: <optional: URL of the PR comment this commit addresses>
|
|
7
|
+
|
|
8
|
+
Co-Authored-By: <AI model name> <AI model email>
|
|
9
|
+
Co-Authored-By: <agent> agent <AI model email>
|
|
10
|
+
```
|
|
@@ -1,99 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
## Project Overview
|
|
4
|
-
|
|
5
|
-
`core_ext` is a Ruby gem that **adds methods to Ruby's standard objects** (core extensions). It extends built-in classes such as `Array`, `Hash`, `Symbol`, `Enumerable`, `Date`, `Object`, `Numeric`, and others with additional utility methods, while maintaining compatibility and predictable behavior.
|
|
6
|
-
|
|
7
|
-
- Gem name: `darthjee-core_ext`
|
|
8
|
-
- YARD docs: [rubydoc.info/gems/darthjee-core_ext](https://www.rubydoc.info/gems/darthjee-core_ext)
|
|
9
|
-
- Extensions live under `lib/darthjee/core_ext/`
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Language
|
|
14
|
-
|
|
15
|
-
- All code, comments, commit messages, pull request titles, PR descriptions, review comments, and documentation **must be written in English**.
|
|
16
|
-
- No exceptions: even if the author's primary language is not English, all contributions to this repository must use English.
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Testing
|
|
21
|
-
|
|
22
|
-
- **Every new feature or bug fix must include tests.**
|
|
23
|
-
- Tests are written using RSpec and live under `spec/`.
|
|
24
|
-
- Follow the existing test structure: unit tests mirror the `lib/` directory layout under `spec/lib/`.
|
|
25
|
-
- If a file does not have a corresponding spec file and **intentionally** has no tests (e.g., it is a pure re-export or namespace file), it must be listed in `config/check_specs.yml` under the `ignore:` key.
|
|
26
|
-
- Do **not** add files to `config/check_specs.yml` as a shortcut to avoid writing tests. Only files that genuinely cannot or should not have direct tests belong there.
|
|
27
|
-
- Run the full test suite before opening a PR: `bundle exec rspec`.
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## Documentation
|
|
32
|
-
|
|
33
|
-
- All public methods must be documented using **YARD** syntax.
|
|
34
|
-
- Use `@param`, `@return`, `@example`, and `@raise` tags where applicable.
|
|
35
|
-
- Include at least one `@example` block for methods that demonstrate non-trivial behavior.
|
|
36
|
-
- Keep documentation close to the code (inline in the source file).
|
|
37
|
-
- Example:
|
|
38
|
-
|
|
39
|
-
```ruby
|
|
40
|
-
# Converts the hash keys to camel case.
|
|
41
|
-
#
|
|
42
|
-
# @param [Symbol] type the case type (:lower or :upper)
|
|
43
|
-
# @return [Hash] a new hash with camel-cased keys
|
|
44
|
-
# @example
|
|
45
|
-
# { my_key: 1 }.camelize_keys #=> { myKey: 1 }
|
|
46
|
-
def camelize_keys(type = :lower)
|
|
47
|
-
# ...
|
|
48
|
-
end
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Design Principles
|
|
54
|
-
|
|
55
|
-
### Single Responsibility
|
|
56
|
-
|
|
57
|
-
- Classes and methods should have **one reason to change** (Single Responsibility Principle).
|
|
58
|
-
- Prefer small, focused methods. If a method is doing more than one thing, extract the extra responsibility into a helper method or a collaborator class.
|
|
59
|
-
- Follow the approach described by **Sandi Metz** in *99 Bottles of OOP*:
|
|
60
|
-
- Prefer simple, obvious code over clever code.
|
|
61
|
-
- Let the tests drive refactoring: make it work, make it right, make it fast.
|
|
62
|
-
- Use small objects that collaborate through messages.
|
|
63
|
-
- Avoid premature abstraction; introduce it only when duplication demands it.
|
|
64
|
-
|
|
65
|
-
### Law of Demeter
|
|
66
|
-
|
|
67
|
-
- Avoid **Law of Demeter violations**: do not chain method calls across multiple object boundaries (e.g., `a.b.c.d`).
|
|
68
|
-
- Instead, delegate behavior closer to the data: expose a method on the intermediate object, or use a helper that encapsulates the traversal.
|
|
69
|
-
- Code that violates the Law of Demeter increases coupling and makes refactoring harder.
|
|
70
|
-
|
|
71
|
-
```ruby
|
|
72
|
-
# Avoid
|
|
73
|
-
user.address.city.upcase
|
|
74
|
-
|
|
75
|
-
# Prefer
|
|
76
|
-
user.city_upcased
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### General Style
|
|
80
|
-
|
|
81
|
-
- Prefer composition over inheritance.
|
|
82
|
-
- Keep class hierarchies shallow.
|
|
83
|
-
- Avoid monkey-patching outside of the intended extension pattern of this gem.
|
|
84
|
-
- New core extensions must be clearly scoped to a specific Ruby class and added in the appropriate file under `lib/darthjee/core_ext/`.
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## Pull Request Guidelines
|
|
89
|
-
|
|
90
|
-
- PR titles and descriptions must be in **English**.
|
|
91
|
-
- Every PR should include:
|
|
92
|
-
- A clear description of what changed and why.
|
|
93
|
-
- References to any related issues.
|
|
94
|
-
- Confirmation that tests pass locally.
|
|
95
|
-
- Reviewers should check that:
|
|
96
|
-
- New code is covered by tests.
|
|
97
|
-
- Documentation follows YARD conventions.
|
|
98
|
-
- Design principles (single responsibility, Demeter) are respected.
|
|
99
|
-
- No file was added to `config/check_specs.yml` without a valid justification.
|
|
1
|
+
See [AGENTS.md](../AGENTS.md) for project instructions.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- One sentence describing what this PR does -->
|
|
4
|
+
|
|
5
|
+
## Problem
|
|
6
|
+
|
|
7
|
+
<!-- What problem does this solve? Why is this change needed? -->
|
|
8
|
+
|
|
9
|
+
## Solution
|
|
10
|
+
|
|
11
|
+
<!-- How was the problem solved? What approach was taken? -->
|
|
12
|
+
|
|
13
|
+
## Details
|
|
14
|
+
|
|
15
|
+
<!-- Optional: implementation notes, migration steps, caveats. Remove this section if not needed. -->
|
|
16
|
+
|
|
17
|
+
Fixes #
|
data/.gitignore
CHANGED
data/AGENTS.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# GitHub Copilot Instructions for `darthjee/core_ext`
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
`core_ext` is a Ruby gem that **adds methods to Ruby's standard objects** (core extensions). It extends built-in classes such as `Array`, `Hash`, `Symbol`, `Enumerable`, `Date`, `Object`, `Numeric`, and others with additional utility methods, while maintaining compatibility and predictable behavior.
|
|
6
|
+
|
|
7
|
+
- Gem name: `darthjee-core_ext`
|
|
8
|
+
- YARD docs: [rubydoc.info/gems/darthjee-core_ext](https://www.rubydoc.info/gems/darthjee-core_ext)
|
|
9
|
+
- Extensions live under `lib/darthjee/core_ext/`
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Language
|
|
14
|
+
|
|
15
|
+
- All code, comments, commit messages, pull request titles, PR descriptions, review comments, and documentation **must be written in English**.
|
|
16
|
+
- No exceptions: even if the author's primary language is not English, all contributions to this repository must use English.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Testing
|
|
21
|
+
|
|
22
|
+
- **Every new feature or bug fix must include tests.**
|
|
23
|
+
- Tests are written using RSpec and live under `spec/`.
|
|
24
|
+
- Follow the existing test structure: unit tests mirror the `lib/` directory layout under `spec/lib/`.
|
|
25
|
+
- If a file does not have a corresponding spec file and **intentionally** has no tests (e.g., it is a pure re-export or namespace file), it must be listed in `config/check_specs.yml` under the `ignore:` key.
|
|
26
|
+
- Do **not** add files to `config/check_specs.yml` as a shortcut to avoid writing tests. Only files that genuinely cannot or should not have direct tests belong there.
|
|
27
|
+
- Run the full test suite before opening a PR: `bundle exec rspec`.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Documentation
|
|
32
|
+
|
|
33
|
+
- All public methods must be documented using **YARD** syntax.
|
|
34
|
+
- Use `@param`, `@return`, `@example`, and `@raise` tags where applicable.
|
|
35
|
+
- Include at least one `@example` block for methods that demonstrate non-trivial behavior.
|
|
36
|
+
- Keep documentation close to the code (inline in the source file).
|
|
37
|
+
- Example:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
# Converts the hash keys to camel case.
|
|
41
|
+
#
|
|
42
|
+
# @param [Symbol] type the case type (:lower or :upper)
|
|
43
|
+
# @return [Hash] a new hash with camel-cased keys
|
|
44
|
+
# @example
|
|
45
|
+
# { my_key: 1 }.camelize_keys #=> { myKey: 1 }
|
|
46
|
+
def camelize_keys(type = :lower)
|
|
47
|
+
# ...
|
|
48
|
+
end
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Design Principles
|
|
54
|
+
|
|
55
|
+
### Single Responsibility
|
|
56
|
+
|
|
57
|
+
- Classes and methods should have **one reason to change** (Single Responsibility Principle).
|
|
58
|
+
- Prefer small, focused methods. If a method is doing more than one thing, extract the extra responsibility into a helper method or a collaborator class.
|
|
59
|
+
- Follow the approach described by **Sandi Metz** in *99 Bottles of OOP*:
|
|
60
|
+
- Prefer simple, obvious code over clever code.
|
|
61
|
+
- Let the tests drive refactoring: make it work, make it right, make it fast.
|
|
62
|
+
- Use small objects that collaborate through messages.
|
|
63
|
+
- Avoid premature abstraction; introduce it only when duplication demands it.
|
|
64
|
+
|
|
65
|
+
### Law of Demeter
|
|
66
|
+
|
|
67
|
+
- Avoid **Law of Demeter violations**: do not chain method calls across multiple object boundaries (e.g., `a.b.c.d`).
|
|
68
|
+
- Instead, delegate behavior closer to the data: expose a method on the intermediate object, or use a helper that encapsulates the traversal.
|
|
69
|
+
- Code that violates the Law of Demeter increases coupling and makes refactoring harder.
|
|
70
|
+
|
|
71
|
+
```ruby
|
|
72
|
+
# Avoid
|
|
73
|
+
user.address.city.upcase
|
|
74
|
+
|
|
75
|
+
# Prefer
|
|
76
|
+
user.city_upcased
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### General Style
|
|
80
|
+
|
|
81
|
+
- Prefer composition over inheritance.
|
|
82
|
+
- Keep class hierarchies shallow.
|
|
83
|
+
- Avoid monkey-patching outside of the intended extension pattern of this gem.
|
|
84
|
+
- New core extensions must be clearly scoped to a specific Ruby class and added in the appropriate file under `lib/darthjee/core_ext/`.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Pull Request Guidelines
|
|
89
|
+
|
|
90
|
+
- PR titles and descriptions must be in **English**.
|
|
91
|
+
- Every PR should include:
|
|
92
|
+
- A clear description of what changed and why.
|
|
93
|
+
- References to any related issues.
|
|
94
|
+
- Confirmation that tests pass locally.
|
|
95
|
+
- Reviewers should check that:
|
|
96
|
+
- New code is covered by tests.
|
|
97
|
+
- Documentation follows YARD conventions.
|
|
98
|
+
- Design principles (single responsibility, Demeter) are respected.
|
|
99
|
+
- No file was added to `config/check_specs.yml` without a valid justification.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Agent Documentation
|
|
104
|
+
|
|
105
|
+
| Document | Description |
|
|
106
|
+
|----------|-------------|
|
|
107
|
+
| [Folder Structure](docs/agents/folder-structure.md) | Top-level directory layout and the role of each folder. |
|
|
108
|
+
| [Architecture](docs/agents/architecture.md) | Source layout and design of the gem. |
|
|
109
|
+
| [Contributing](docs/agents/contributing.md) | Commit guidelines, PR standards, code organization, and refactoring rules. |
|
|
110
|
+
|
|
111
|
+
## Commit Attribution
|
|
112
|
+
|
|
113
|
+
Commit co-author trailers follow arcanum's resolved `git.omit_model_coauthor` and `git.remove_coauthors` config (check them with `/arcanum-check-config`); this overrides Claude Code's own attribution reminder for every commit, including ones written by hand.
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
See [AGENTS.md](AGENTS.md) for project instructions.
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
|
@@ -5,22 +5,22 @@ source 'https://rubygems.org'
|
|
|
5
5
|
# Specify your gem's dependencies in credential_builder.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem 'bundler', '>=
|
|
8
|
+
gem 'bundler', '>= 4.0.24'
|
|
9
9
|
gem 'pry', '0.14.2'
|
|
10
10
|
gem 'pry-nav', '1.0.0'
|
|
11
|
-
gem 'rake', '13.2
|
|
11
|
+
gem 'rake', '13.4.2'
|
|
12
12
|
gem 'reek', '6.5.0'
|
|
13
13
|
gem 'rspec', '3.13.2'
|
|
14
|
-
gem 'rspec-core', '3.13.
|
|
15
|
-
gem 'rspec-expectations', '3.13.
|
|
16
|
-
gem 'rspec-mocks', '3.13.
|
|
17
|
-
gem 'rspec-support', '3.13.
|
|
18
|
-
gem 'rubocop', '1.
|
|
14
|
+
gem 'rspec-core', '3.13.7'
|
|
15
|
+
gem 'rspec-expectations', '3.13.6'
|
|
16
|
+
gem 'rspec-mocks', '3.13.9'
|
|
17
|
+
gem 'rspec-support', '3.13.8'
|
|
18
|
+
gem 'rubocop', '1.92.2'
|
|
19
19
|
gem 'rubocop-rake', '0.7.1'
|
|
20
|
-
gem 'rubocop-rspec', '3.
|
|
20
|
+
gem 'rubocop-rspec', '3.10.2'
|
|
21
21
|
gem 'rubycritic', '5.0.0'
|
|
22
22
|
gem 'simplecov', '0.22.0'
|
|
23
23
|
gem 'simplecov-html', '0.13.2'
|
|
24
24
|
gem 'simplecov-lcov', '0.9.0'
|
|
25
|
-
gem 'yard', '0.9.
|
|
25
|
+
gem 'yard', '0.9.45'
|
|
26
26
|
gem 'yardstick', '0.9.9'
|
data/README.md
CHANGED
|
@@ -9,11 +9,11 @@ Darthjee/CoreExt
|
|
|
9
9
|
|
|
10
10
|
Yard Documentation
|
|
11
11
|
-------------------
|
|
12
|
-
[https://www.rubydoc.info/gems/darthjee-core_ext/3.
|
|
12
|
+
[https://www.rubydoc.info/gems/darthjee-core_ext/3.2.0](https://www.rubydoc.info/gems/darthjee-core_ext/3.2.0)
|
|
13
13
|
|
|
14
|
-
**Current Release**: [3.
|
|
14
|
+
**Current Release**: [3.2.0](https://github.com/darthjee/core_ext/tree/3.2.0)
|
|
15
15
|
|
|
16
|
-
**Next release**: [3.
|
|
16
|
+
**Next release**: [3.3.0](https://github.com/darthjee/core_ext/compare/3.2.0...main)
|
|
17
17
|
|
|
18
18
|
# Usage
|
|
19
19
|
This project adds some new methods to the core ruby classes
|
data/core_ext.jpg
CHANGED
|
Binary file
|
data/docker-compose.yml
CHANGED
|
@@ -23,7 +23,7 @@ services:
|
|
|
23
23
|
command: /bin/bash -c 'rspec && yard && rake yardstick_measure && rake verify_measurements'
|
|
24
24
|
|
|
25
25
|
core_ext_circleci:
|
|
26
|
-
image: darthjee/
|
|
26
|
+
image: darthjee/circleci_ruby_3412:1.0.0
|
|
27
27
|
container_name: core_ext_circleci
|
|
28
28
|
command: /bin/bash
|
|
29
29
|
volumes:
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Arcanum Split Issue
|
|
2
|
+
|
|
3
|
+
A checklist of concerns to consider when splitting a broad issue into sub-issues via `/arcanum-split-issue`. Not exhaustive — adjust or extend the list for this project's needs.
|
|
4
|
+
|
|
5
|
+
- **Sub-issue granularity** — is each sub-issue independently workable, or does it still depend on another sub-issue landing first?
|
|
6
|
+
- **Standalone clarity** — does each sub-issue stand on its own, without requiring the reader to have the parent issue open to understand it?
|
|
7
|
+
- **Shared contracts** — interfaces, schemas, or config keys touched by more than one sub-issue, and who owns getting them right first.
|
|
8
|
+
- **Sequencing** — is there a natural order sub-issues should be implemented/merged in, or can they proceed in parallel?
|
|
9
|
+
- **Responsible agents** — which specialist agent(s) each sub-issue is likely to fall to.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`darthjee-core_ext` is a Ruby gem that adds utility methods to Ruby's built-in classes. Each extension is scoped to one core class and lives in its own file, so a consumer can require only what they need.
|
|
6
|
+
|
|
7
|
+
## Source Code Layout
|
|
8
|
+
|
|
9
|
+
All source lives under `lib/darthjee/core_ext/`. `lib/darthjee.rb` is the entry point.
|
|
10
|
+
|
|
11
|
+
- `array.rb`, `class.rb`, `date.rb`, `enumerable.rb`, `hash.rb`, `math.rb`, `numeric.rb`, `object.rb`, `symbol.rb` and `time.rb` each extend the matching core class.
|
|
12
|
+
- `version.rb` holds the gem version.
|
|
13
|
+
|
|
14
|
+
### `array/`
|
|
15
|
+
|
|
16
|
+
`HashBuilder`, a helper behind the `Array` extension that builds hashes.
|
|
17
|
+
|
|
18
|
+
### `hash/`
|
|
19
|
+
|
|
20
|
+
Collaborators for the `Hash` extension, one responsibility per class:
|
|
21
|
+
|
|
22
|
+
- Key and value changing: `key_changer`, `value_changer`, `key_changeable`, `changeable`
|
|
23
|
+
- Camel-casing: `cameliazable`
|
|
24
|
+
- Sorting keys: `keys_sorter`
|
|
25
|
+
- Chained fetching: `chain_fetcher`
|
|
26
|
+
- Squashing nested hashes: `squasher`
|
|
27
|
+
- Transforming and transposing: `transformable`, `transposeable`
|
|
28
|
+
- Deep construction: `deep_hash_constructor`
|
|
29
|
+
|
|
30
|
+
## Conventions
|
|
31
|
+
|
|
32
|
+
- Public methods are documented with YARD. The Yardstick config is in `config/`.
|
|
33
|
+
- Specs mirror `lib/` under `spec/lib/`. Files without specs must be listed in `config/check_specs.yml`.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Commit Guidelines
|
|
4
|
+
|
|
5
|
+
- **Atomic and Unitary:** Each commit must represent a single logical change.
|
|
6
|
+
*Example:*
|
|
7
|
+
- Good: `Add Hash#squash method`
|
|
8
|
+
- Bad: `Add Hash#squash and refactor KeyChanger`
|
|
9
|
+
- **No Unrelated Changes:** Do not mix unrelated changes in the same commit.
|
|
10
|
+
- **Separate Refactoring:** Whenever possible, separate refactoring commits from new feature or bugfix commits.
|
|
11
|
+
|
|
12
|
+
## Pull Requests
|
|
13
|
+
|
|
14
|
+
- **Descriptive Summary:** Every PR must include a clear and descriptive summary of its purpose and changes.
|
|
15
|
+
- **PR Description Files:** If a description cannot be provided directly in the PR, generate a file with the PR description (e.g., `docs/agents/issues/<pr_number>_description.md`), but do not commit this file.
|
|
16
|
+
|
|
17
|
+
## Definition of Done for PRs
|
|
18
|
+
|
|
19
|
+
A PR is considered complete when:
|
|
20
|
+
|
|
21
|
+
- The stated objective has been achieved.
|
|
22
|
+
- All tests are passing.
|
|
23
|
+
- Linting passes without errors.
|
|
24
|
+
- Code coverage is as high as reasonably possible.
|
|
25
|
+
- Code is not overly complex:
|
|
26
|
+
- Classes and methods should have clear, focused responsibilities.
|
|
27
|
+
- If a class or method is taking on too many responsibilities, refactor to simplify.
|
|
28
|
+
- Methods should be small and do exactly one thing. If a method is growing, extract parts into private helper methods or separate classes.
|
|
29
|
+
- *Example (pseudo-code):*
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
# Good: each method does one thing
|
|
33
|
+
class Worker
|
|
34
|
+
def fetch_job; end
|
|
35
|
+
def process_job(job); end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Bad: method does too much
|
|
39
|
+
class Worker
|
|
40
|
+
def run
|
|
41
|
+
fetch_job
|
|
42
|
+
process_job
|
|
43
|
+
send_metrics
|
|
44
|
+
cleanup
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- This requirement applies primarily to source code. For specs, refactor only if there is excessive duplication.
|
|
50
|
+
|
|
51
|
+
### CI Checks
|
|
52
|
+
|
|
53
|
+
Before a PR is considered complete, all CI checks must pass locally. The project has a single Ruby codebase, so every code change runs both CircleCI jobs (`.circleci/config.yml`):
|
|
54
|
+
|
|
55
|
+
| CircleCI job | Local command |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| `test` | `bundle exec rspec` |
|
|
58
|
+
| `checks` | `bundle exec rubocop` |
|
|
59
|
+
| `checks` | `bundle exec rake verify_measurements` (YARD documentation coverage; run `bundle exec rake yardstick_measure` first if needed) |
|
|
60
|
+
| `checks` | `PROJECT=darthjee-core_ext scripts/check_readme.sh` (README must reference the current version's YARD docs) |
|
|
61
|
+
| `checks` | `scripts/rubycritic.sh` (RubyCritic on changed `lib/` files) |
|
|
62
|
+
| `checks` | `check_specs` (every `lib/` file needs a spec unless listed in `config/check_specs.yml`) |
|
|
63
|
+
|
|
64
|
+
Commands can also be run inside Docker via `docker-compose run core_ext_circleci`, `make dev` or `make ci`.
|
|
65
|
+
|
|
66
|
+
This same process must be followed when **planning how to resolve an issue**: include a final step in the plan that lists the CI commands to run before opening a PR.
|
|
67
|
+
|
|
68
|
+
## Code Organization
|
|
69
|
+
|
|
70
|
+
### File Responsibility: Class Declarers vs Scripts
|
|
71
|
+
|
|
72
|
+
Every source file under `lib/` must define one or more classes or modules and must not execute logic or cause side effects at load time. The only extension point is reopening/including into core classes, which is the purpose of this gem.
|
|
73
|
+
|
|
74
|
+
### File Naming
|
|
75
|
+
|
|
76
|
+
Files use `snake_case.rb` and mirror the constant they define (`KeyChanger` in `key_changer.rb`). Specs mirror `lib/` under `spec/lib/` with a `_spec.rb` suffix. Core extensions go in `lib/darthjee/core_ext/<class>.rb`; collaborators go in a sibling folder named after the class (e.g. `hash/`).
|
|
77
|
+
|
|
78
|
+
### Method Order: Public Before Private
|
|
79
|
+
|
|
80
|
+
Public methods are declared before `private` ones; private methods are implementation helpers placed at the end of the class.
|
|
81
|
+
|
|
82
|
+
```ruby
|
|
83
|
+
# Good
|
|
84
|
+
class Worker
|
|
85
|
+
def run
|
|
86
|
+
prepare
|
|
87
|
+
execute
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
private
|
|
91
|
+
|
|
92
|
+
def prepare; end
|
|
93
|
+
def execute; end
|
|
94
|
+
end
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Dependency Injection
|
|
98
|
+
|
|
99
|
+
Classes receive their dependencies (data, collaborators) as constructor arguments and never load files or read environment variables themselves. This keeps every class independently testable.
|
|
100
|
+
|
|
101
|
+
```ruby
|
|
102
|
+
# Good
|
|
103
|
+
class Router
|
|
104
|
+
def initialize(data)
|
|
105
|
+
@data = data
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Bad
|
|
110
|
+
class Router
|
|
111
|
+
def build
|
|
112
|
+
data = YAML.load_file('./data.yml')
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Refactoring Guidelines
|
|
118
|
+
|
|
119
|
+
When refactoring, aim to:
|
|
120
|
+
|
|
121
|
+
- **Reduce Code Duplication:** move repeated spec setup into `let` blocks or shared helpers.
|
|
122
|
+
- **Keep Classes Focused:** extract responsibilities into collaborator classes (see `lib/darthjee/core_ext/hash/`).
|
|
123
|
+
- **Follow the Law of Demeter:** avoid chains like `a.b.c.d`.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Folder Structure
|
|
2
|
+
|
|
3
|
+
## Project Root
|
|
4
|
+
|
|
5
|
+
| Directory / File | Description |
|
|
6
|
+
|------------------|-------------|
|
|
7
|
+
| `lib/` | Gem source code (`lib/darthjee/core_ext/`). |
|
|
8
|
+
| `spec/` | RSpec tests: `lib/` mirrors the source layout, `integration/` holds README and YARD checks, `support/` holds helpers. |
|
|
9
|
+
| `config/` | Tooling config: `check_specs.yml` (files exempt from needing specs), RubyCritic and Yardstick settings. |
|
|
10
|
+
| `scripts/` | Helper shell scripts (`check_readme.sh`, `rubycritic.sh`). |
|
|
11
|
+
| `.circleci/` | CircleCI pipeline. |
|
|
12
|
+
| `.github/` | Copilot pointer, PR template and commit message templates. |
|
|
13
|
+
| `docs/agents/` | Documentation, issues and plans for AI agents. |
|
|
14
|
+
| `*_README.md` | Per-class usage docs (Array, Class, Date, Enumerable, Hash, Math, Object, Symbol), linked from `README.md`. |
|
|
15
|
+
| `core_ext.gemspec`, `Gemfile`, `Rakefile` | Gem packaging and dependencies. |
|
|
16
|
+
| `Dockerfile`, `docker-compose.yml`, `Makefile` | Dev and CI container environment (`make dev`, `make ci`). |
|
|
17
|
+
| `.rubocop*.yml`, `.reek.yml` | Lint and code-smell configuration. |
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Issue Enhancement
|
|
2
|
+
|
|
3
|
+
A checklist of concerns to consider when fleshing out a vague issue idea (tagged `Idea`/`Writting`) before it reaches the `Created` stage. Not exhaustive — adjust or extend the list for this project's needs.
|
|
4
|
+
|
|
5
|
+
- **Scope boundaries** — what's explicitly in scope and what's explicitly out.
|
|
6
|
+
- **Alternative solutions** — other ways to solve the same problem, and why this one was chosen.
|
|
7
|
+
- **Edge cases** — inputs, states, or timing the happy path doesn't cover.
|
|
8
|
+
- **Backward compatibility** — whether this breaks existing behavior, data, or integrations.
|
|
9
|
+
- **Testing strategy** — how the change will be verified.
|
|
10
|
+
- **Performance & security considerations** — anything relevant to load, latency, or attack surface.
|
|
11
|
+
- **Obsolescence** — whether the method (or the one being changed) is obsolete because Ruby now provides an equivalent, and if so, whether to deprecate, alias or remove it.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Usage: scripts/bump_version.sh [major|minor|patch|X.Y.Z]
|
|
3
|
+
# Without arguments, bumps the patch version of the current version.
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
ROOT="$(git rev-parse --show-toplevel)"
|
|
8
|
+
README="$ROOT/README.md"
|
|
9
|
+
VERSION_FILE="$ROOT/lib/darthjee/core_ext/version.rb"
|
|
10
|
+
LOCKFILE="$ROOT/Gemfile.lock"
|
|
11
|
+
GEM="darthjee-core_ext"
|
|
12
|
+
|
|
13
|
+
current=$(grep -oE "VERSION = '[0-9]+\.[0-9]+\.[0-9]+'" "$VERSION_FILE" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
|
|
14
|
+
IFS='.' read -r cmajor cminor cpatch <<< "$current"
|
|
15
|
+
|
|
16
|
+
arg="${1:-patch}"
|
|
17
|
+
|
|
18
|
+
case "$arg" in
|
|
19
|
+
major) new_version="$((cmajor + 1)).0.0" ;;
|
|
20
|
+
minor) new_version="${cmajor}.$((cminor + 1)).0" ;;
|
|
21
|
+
patch) new_version="${cmajor}.${cminor}.$((cpatch + 1))" ;;
|
|
22
|
+
*) new_version="$arg" ;;
|
|
23
|
+
esac
|
|
24
|
+
|
|
25
|
+
# Validate semver format
|
|
26
|
+
if ! echo "$new_version" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
|
|
27
|
+
echo "Error: version must be major, minor, patch or X.Y.Z" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Next release: following minor
|
|
32
|
+
IFS='.' read -r major minor _patch <<< "$new_version"
|
|
33
|
+
next_release="${major}.$((minor + 1)).0"
|
|
34
|
+
|
|
35
|
+
echo "Current version: $current"
|
|
36
|
+
echo "New version: $new_version"
|
|
37
|
+
echo "Next release: $next_release"
|
|
38
|
+
|
|
39
|
+
# version.rb
|
|
40
|
+
sed -i '' "s|VERSION = '[0-9.]*'|VERSION = '${new_version}'|" "$VERSION_FILE"
|
|
41
|
+
|
|
42
|
+
# README: YARD docs link
|
|
43
|
+
sed -i '' \
|
|
44
|
+
"s|rubydoc.info/gems/${GEM}/[0-9.]*|rubydoc.info/gems/${GEM}/${new_version}|g" \
|
|
45
|
+
"$README"
|
|
46
|
+
|
|
47
|
+
# README: Current Release line
|
|
48
|
+
sed -i '' \
|
|
49
|
+
"s|\*\*Current Release\*\*: \[[0-9.]*\](https://github.com/darthjee/core_ext/tree/[0-9.]*)|**Current Release**: [${new_version}](https://github.com/darthjee/core_ext/tree/${new_version})|" \
|
|
50
|
+
"$README"
|
|
51
|
+
|
|
52
|
+
# README: Next release line
|
|
53
|
+
sed -i '' \
|
|
54
|
+
"s|\*\*Next release\*\*: \[[0-9.]*\](https://github.com/darthjee/core_ext/compare/[0-9.]*\.\.\.main)|**Next release**: [${next_release}](https://github.com/darthjee/core_ext/compare/${new_version}...main)|" \
|
|
55
|
+
"$README"
|
|
56
|
+
|
|
57
|
+
# Gemfile.lock
|
|
58
|
+
if [ -f "$LOCKFILE" ]; then
|
|
59
|
+
sed -i '' "s|^\( *${GEM} (\)[0-9.]*)|\1${new_version})|" "$LOCKFILE"
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
echo "Done."
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
|
-
# frozen_string_literal: true
|
|
6
|
-
|
|
7
5
|
describe Hash do
|
|
8
6
|
describe 'readme' do
|
|
9
7
|
describe '#chain_fetch' do
|
|
@@ -58,7 +56,7 @@ describe Hash do
|
|
|
58
56
|
end
|
|
59
57
|
|
|
60
58
|
it 'changes the values skipping inner' do
|
|
61
|
-
expect(result).to eq(a: '2', b: Array, d: '{:
|
|
59
|
+
expect(result).to eq(a: '2', b: Array, d: '{e: 3}')
|
|
62
60
|
end
|
|
63
61
|
end
|
|
64
62
|
end
|
|
@@ -101,7 +99,7 @@ describe Hash do
|
|
|
101
99
|
it 'changes the values skipping inner' do
|
|
102
100
|
expect { result }
|
|
103
101
|
.to change { hash }
|
|
104
|
-
.to(a: '2', b: Array, d: '{:
|
|
102
|
+
.to(a: '2', b: Array, d: '{e: 3}')
|
|
105
103
|
end
|
|
106
104
|
end
|
|
107
105
|
end
|
|
@@ -25,7 +25,7 @@ describe Darthjee::CoreExt::Hash::Changeable do
|
|
|
25
25
|
|
|
26
26
|
it 'changes the values' do
|
|
27
27
|
expect(hash.change_values(skip_inner: false, &:to_s))
|
|
28
|
-
.to eq(a: '1', b: '{:
|
|
28
|
+
.to eq(a: '1', b: '{c: 1}')
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
end
|
|
@@ -56,7 +56,7 @@ describe Darthjee::CoreExt::Hash::Changeable do
|
|
|
56
56
|
expect { hash.change_values!(skip_inner: false, &:to_s) }
|
|
57
57
|
.to change { hash }
|
|
58
58
|
.from(a: 1, b: { c: 2 })
|
|
59
|
-
.to(a: '1', b: '{:
|
|
59
|
+
.to(a: '1', b: '{c: 2}')
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
it 'changes the inner hash' do
|
|
@@ -24,7 +24,7 @@ describe Darthjee::CoreExt::Object do
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
# rubocop: disable RSpec/PredicateMatcher
|
|
27
|
+
# rubocop: disable-next RSpec/PredicateMatcher
|
|
28
28
|
describe '#trueful?' do
|
|
29
29
|
describe 'Calling on nil object' do
|
|
30
30
|
it { expect(nil.trueful?).not_to be_truthy }
|
|
@@ -42,6 +42,5 @@ describe Darthjee::CoreExt::Object do
|
|
|
42
42
|
it { expect(''.trueful?).to be_truthy }
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
|
-
# rubocop: enable RSpec/PredicateMatcher
|
|
46
45
|
end
|
|
47
46
|
end
|
|
@@ -73,7 +73,7 @@ describe Darthjee::CoreExt::Hash::ValueChanger do
|
|
|
73
73
|
let(:options) { { skip_inner: false } }
|
|
74
74
|
|
|
75
75
|
it 'apply change on inner hash' do
|
|
76
|
-
expect(changer.change(object)).to eq(a:
|
|
76
|
+
expect(changer.change(object)).to eq(a: 8)
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
|
|
@@ -81,7 +81,7 @@ describe Darthjee::CoreExt::Hash::ValueChanger do
|
|
|
81
81
|
let(:options) { { skip_inner: false, recursive: false } }
|
|
82
82
|
|
|
83
83
|
it 'applies the transformation before attempting recusrsive' do
|
|
84
|
-
expect(changer.change(object)).to eq(a:
|
|
84
|
+
expect(changer.change(object)).to eq(a: 8)
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
end
|
|
@@ -105,7 +105,7 @@ describe Darthjee::CoreExt::Hash::ValueChanger do
|
|
|
105
105
|
let(:options) { { skip_inner: false } }
|
|
106
106
|
|
|
107
107
|
it 'applies transformation over inner hash' do
|
|
108
|
-
expect(changer.change(object)).to eq(a:
|
|
108
|
+
expect(changer.change(object)).to eq(a: 10)
|
|
109
109
|
end
|
|
110
110
|
end
|
|
111
111
|
|
|
@@ -113,7 +113,7 @@ describe Darthjee::CoreExt::Hash::ValueChanger do
|
|
|
113
113
|
let(:options) { { skip_inner: false, recursive: false } }
|
|
114
114
|
|
|
115
115
|
it 'applies transformation before going recursive' do
|
|
116
|
-
expect(changer.change(object)).to eq(a:
|
|
116
|
+
expect(changer.change(object)).to eq(a: 10)
|
|
117
117
|
end
|
|
118
118
|
end
|
|
119
119
|
end
|
|
@@ -170,7 +170,7 @@ describe Darthjee::CoreExt::Hash::ValueChanger do
|
|
|
170
170
|
let(:options) { { skip_inner: false } }
|
|
171
171
|
|
|
172
172
|
it 'applies transformation on the first value of a hash' do
|
|
173
|
-
expect(changer.change(object)).to eq([[{ a: 3 }], [{ b:
|
|
173
|
+
expect(changer.change(object)).to eq([[{ a: 3 }], [{ b: 9 }]])
|
|
174
174
|
end
|
|
175
175
|
end
|
|
176
176
|
|
|
@@ -178,7 +178,7 @@ describe Darthjee::CoreExt::Hash::ValueChanger do
|
|
|
178
178
|
let(:options) { { skip_inner: false, recursive: false } }
|
|
179
179
|
|
|
180
180
|
it 'applies transformation before going recursive' do
|
|
181
|
-
expect(changer.change(object)).to eq([[{ a: 3 }], [{ b:
|
|
181
|
+
expect(changer.change(object)).to eq([[{ a: 3 }], [{ b: 9 }]])
|
|
182
182
|
end
|
|
183
183
|
end
|
|
184
184
|
end
|
|
@@ -193,7 +193,7 @@ describe Darthjee::CoreExt::Hash::ValueChanger do
|
|
|
193
193
|
end
|
|
194
194
|
|
|
195
195
|
it 'treat result of transformation as new hashes to be transformed' do
|
|
196
|
-
expected = { a: { size: 1 }, c:
|
|
196
|
+
expected = { a: { size: 1 }, c: 7, e: { size: 1 } }
|
|
197
197
|
expect(changer.change(object)).to eq(expected)
|
|
198
198
|
end
|
|
199
199
|
|
|
@@ -201,7 +201,7 @@ describe Darthjee::CoreExt::Hash::ValueChanger do
|
|
|
201
201
|
let(:options) { { skip_inner: false, recursive: false } }
|
|
202
202
|
|
|
203
203
|
it 'does not iterate over returned hash' do
|
|
204
|
-
expected = { a: { size: 1 }, c:
|
|
204
|
+
expected = { a: { size: 1 }, c: 7, e: { size: 0 } }
|
|
205
205
|
expect(changer.change(object)).to eq(expected)
|
|
206
206
|
end
|
|
207
207
|
end
|
data/spec/lib/object_spec.rb
CHANGED
|
@@ -35,7 +35,7 @@ describe Object do
|
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
# rubocop: disable RSpec/PredicateMatcher
|
|
38
|
+
# rubocop: disable-next RSpec/PredicateMatcher
|
|
39
39
|
describe '#trueful?' do
|
|
40
40
|
context 'when object is an empty array' do
|
|
41
41
|
it { expect([].trueful?).to be_truthy }
|
|
@@ -65,5 +65,4 @@ describe Object do
|
|
|
65
65
|
it { expect(false.trueful?).not_to be_truthy }
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
|
-
# rubocop: enable RSpec/PredicateMatcher
|
|
69
68
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: darthjee-core_ext
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Darthjee
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activesupport
|
|
@@ -32,15 +31,27 @@ extensions: []
|
|
|
32
31
|
extra_rdoc_files: []
|
|
33
32
|
files:
|
|
34
33
|
- ".circleci/config.yml"
|
|
34
|
+
- ".claude/agents/architect.md"
|
|
35
|
+
- ".claude/agents/legacy.md"
|
|
36
|
+
- ".claude/agents/ruby.md"
|
|
37
|
+
- ".claude/agents/security.md"
|
|
38
|
+
- ".claude/configuration/arcanum-repo-config.json"
|
|
39
|
+
- ".claude/scripts/check_ruby.sh"
|
|
40
|
+
- ".claude/settings.json"
|
|
41
|
+
- ".github/commit_message_template-2.0.md"
|
|
42
|
+
- ".github/commit_message_template.md"
|
|
35
43
|
- ".github/copilot-instructions.md"
|
|
36
44
|
- ".github/core_ext-usage.md"
|
|
45
|
+
- ".github/pull_request_template.md"
|
|
37
46
|
- ".gitignore"
|
|
38
47
|
- ".reek.yml"
|
|
39
48
|
- ".rspec"
|
|
40
49
|
- ".rubocop.yml"
|
|
41
50
|
- ".rubocop_todo.yml"
|
|
51
|
+
- AGENTS.md
|
|
42
52
|
- ARRAY_README.md
|
|
43
53
|
- CLASS_README.md
|
|
54
|
+
- CLAUDE.md
|
|
44
55
|
- DATE_README.md
|
|
45
56
|
- Dockerfile
|
|
46
57
|
- ENUMERABLE_README.md
|
|
@@ -60,6 +71,13 @@ files:
|
|
|
60
71
|
- core_ext.gemspec
|
|
61
72
|
- core_ext.jpg
|
|
62
73
|
- docker-compose.yml
|
|
74
|
+
- docs/agents/arcanum-split-issue.md
|
|
75
|
+
- docs/agents/architecture.md
|
|
76
|
+
- docs/agents/contributing.md
|
|
77
|
+
- docs/agents/folder-structure.md
|
|
78
|
+
- docs/agents/issue-enhancement.md
|
|
79
|
+
- docs/agents/issues/.gitkeep
|
|
80
|
+
- docs/agents/plans/.gitkeep
|
|
63
81
|
- lib/darthjee.rb
|
|
64
82
|
- lib/darthjee/core_ext.rb
|
|
65
83
|
- lib/darthjee/core_ext/array.rb
|
|
@@ -86,6 +104,7 @@ files:
|
|
|
86
104
|
- lib/darthjee/core_ext/symbol.rb
|
|
87
105
|
- lib/darthjee/core_ext/time.rb
|
|
88
106
|
- lib/darthjee/core_ext/version.rb
|
|
107
|
+
- scripts/bump_version.sh
|
|
89
108
|
- scripts/check_readme.sh
|
|
90
109
|
- scripts/rubycritic.sh
|
|
91
110
|
- spec/integration/readme/array_spec.rb
|
|
@@ -164,7 +183,6 @@ homepage: https://github.com/darthjee/core_ext
|
|
|
164
183
|
licenses: []
|
|
165
184
|
metadata:
|
|
166
185
|
rubygems_mfa_required: 'false'
|
|
167
|
-
post_install_message:
|
|
168
186
|
rdoc_options: []
|
|
169
187
|
require_paths:
|
|
170
188
|
- lib
|
|
@@ -179,8 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
179
197
|
- !ruby/object:Gem::Version
|
|
180
198
|
version: '0'
|
|
181
199
|
requirements: []
|
|
182
|
-
rubygems_version:
|
|
183
|
-
signing_key:
|
|
200
|
+
rubygems_version: 4.0.23
|
|
184
201
|
specification_version: 4
|
|
185
202
|
summary: Core Extensions
|
|
186
203
|
test_files: []
|