u-attributes 3.0.1 → 3.0.2
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 +296 -0
- data/CLAUDE.md +112 -0
- data/README.md +2 -2
- data/lib/micro/attributes/version.rb +1 -1
- data/u-attributes.gemspec +4 -0
- metadata +8 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce976187103ccbc2e0b024a654f419e5386393287585909d0d38183d07a6a091
|
|
4
|
+
data.tar.gz: cc900f5ee1593a85e0358977158ae4839eec09f34a8e0fd6d79b22da4920d104
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ed4d876fcc28b5b21c512beb1e591d58db3742141446a5ff7add8f53f986e0da6eb6d6862da72b3d81bf09509b66086c5219364037d10fbb631b1457fc396b2
|
|
7
|
+
data.tar.gz: a30027af6107c1028951c750d4866782f01d85f884cb5b73668c9130acd3229788a0f5cf3e1869d94e03f071ff96953c8902fc6619056f72f9b512890c201b7d
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
> **Note:** This gem was originally published as `micro-attributes` (`0.1.0`) and renamed to `u-attributes` starting with `0.2.0` on 2019-07-02.
|
|
9
|
+
|
|
10
|
+
## [3.0.2] - 2026-05-24
|
|
11
|
+
### Added
|
|
12
|
+
- This `CHANGELOG.md`, covering the full history of the gem (from `micro-attributes 0.1.0` through `u-attributes 3.0.2`) following the [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/) spec.
|
|
13
|
+
- `changelog_uri`, `source_code_uri` and `bug_tracker_uri` entries in `spec.metadata` so RubyGems.org surfaces direct links from the gem page and tools like `bundle outdated` can deep-link to the changelog.
|
|
14
|
+
|
|
15
|
+
## [3.0.1] - 2026-05-23
|
|
16
|
+
### Fixed
|
|
17
|
+
- Widened the `kind` runtime dependency upper bound from `< 6.0` to `< 7.0` so `u-attributes 3.x` resolves against the just-released `kind 6.x` (no API change in `u-attributes`; pure dependency unlock).
|
|
18
|
+
|
|
19
|
+
## [3.0.0] - 2026-05-23
|
|
20
|
+
### Changed
|
|
21
|
+
- **BREAKING:** Bumped minimum Ruby to **2.7.0** (Ruby 2.2 – 2.6 are EOL and no longer supported).
|
|
22
|
+
- Modernized the CI/test runner via Appraisal (mirroring the `u-case` layout): the per-Ruby `ENV`-switched `Gemfile` and the `bin/test` + `bin/prepare_coverage` scripts were replaced with an `Appraisals` file gated on `RUBY_VERSION` (covering `activemodel` 6.0 – 8.1 + edge), and the GitHub Actions matrix was rewritten to cover Ruby 2.7 – 4.0+head with conditional Rails steps plus a no-`activemodel` baseline job.
|
|
23
|
+
- Switched code coverage reporting from CodeClimate to **Qlty** (badges updated in the README).
|
|
24
|
+
- README polish: new header/badge layout aligned with `solid-process`, refreshed Documentation/Compatibility tables (1.x dropped — long EOL), and a new Ruby × Rails support matrix.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- `Appraisals` file plus Appraisal-generated gemfiles for **Rails 8.1** and **Rails edge**.
|
|
28
|
+
- `bin/matrix` script and `rake matrix` task to run the full local test matrix.
|
|
29
|
+
- `bin/setup` script.
|
|
30
|
+
- README documentation for the 2.x features that had landed without docs (tracking issue #35): the **Accept** extension (`accept:` / `reject:` / `allow_nil:` / `rejection_message:` + strict mode, closes #8), attribute **visibility** options (`private:` / `protected:`, closes #10), the **`freeze:`** option (`true` / `:after_dup` / `:after_clone`, closes #33), the trailing options hash on `attributes(...)` for sharing defaults/visibility/validations across multiple attributes (closes #26), and the reader-first behavior of `extract_attributes_from` (closes #24).
|
|
31
|
+
|
|
32
|
+
### Removed
|
|
33
|
+
- Per-Ruby `bin/test` and `bin/prepare_coverage` scripts (superseded by Appraisal + `bin/matrix`).
|
|
34
|
+
- The 1.x row from the README Documentation and Compatibility tables (the documentation-version table still links to the older docs for anyone needing them).
|
|
35
|
+
|
|
36
|
+
### Security
|
|
37
|
+
- Hardened the GitHub Actions workflow: least-privilege `contents: read` permissions on the test job and `persist-credentials: false` on `actions/checkout`.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
- Ruby 3.4+/4.0 test compatibility: switched `MiniTest::Test` to `Minitest::Test`, made the `private`/`protected` method-error assertion quote-agnostic (Ruby 3.4 changed the quoting), and derived the `Hash#inspect`-based expected string at runtime (Ruby 3.4 changed the format).
|
|
41
|
+
- Pre-require `logger`/`stringio` in the test helper so old Rails (`activemodel` 6.0/7.0) loads on Ruby 3+ (neither is auto-loaded any more).
|
|
42
|
+
- Make the baseline Gemfile work on Ruby 4.0 by declaring `logger` and `stringio` explicitly (Ruby 4.0 prunes those default gems) and disable `error_highlight`'s source-snippet annotation in the test helper so the lib's exact error-message assertions stay stable on Ruby 3.1+.
|
|
43
|
+
|
|
44
|
+
## [2.8.0] - 2021-08-24
|
|
45
|
+
### Added
|
|
46
|
+
- Allow the `default:` option to receive a callable via `&:to_proc` (e.g. `default: :upcase.to_proc`).
|
|
47
|
+
- Pass the raw input as the second argument to `default:` procs, so a default can react to the value being assigned.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
- Migrate CI from Travis to GitHub Actions.
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
- Fix the `Kind::Error` raise path so the right exception class/message is surfaced when an invalid value reaches the attribute.
|
|
54
|
+
- Fix `bin/test`.
|
|
55
|
+
|
|
56
|
+
## [2.7.0] - 2021-02-22
|
|
57
|
+
### Changed
|
|
58
|
+
- Bump the `kind` runtime dependency to `>= 4.0, < 6.0`.
|
|
59
|
+
|
|
60
|
+
## [2.6.0] - 2020-09-22
|
|
61
|
+
### Added
|
|
62
|
+
- `freeze:` attribute option (`true` / `:after_dup` / `:after_clone`) to freeze attribute values automatically (issue #33).
|
|
63
|
+
- `private:` and `protected:` attribute options to control the visibility of the generated reader (issue #10).
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
- Preserve the `freeze:` / `private:` / `protected:` options when attributes are inherited.
|
|
67
|
+
|
|
68
|
+
## [2.5.0] - 2020-09-21
|
|
69
|
+
### Added
|
|
70
|
+
- **Accept** extension (`Micro::Attributes.with(:accept)`, issue #8): the `accept:` / `reject:` attribute options validate a value at assignment time and can use a `Class` (kind-of check), a predicate `Symbol` (sent to the value), or a callable. The `allow_nil:` option opts out of validation when `nil`, `rejection_message:` customizes the error message (a callable can return a per-value message), and the new strict variant raises immediately when validation fails.
|
|
71
|
+
- Make the Accept and `ActiveModel::Validations` extensions interoperate.
|
|
72
|
+
|
|
73
|
+
## [2.4.0] - 2020-09-11
|
|
74
|
+
### Added
|
|
75
|
+
- `Micro::Attributes.with(:keys_as_symbol)` extension to expose attribute keys as symbols.
|
|
76
|
+
- Allow declaring `keys_as` as a symbol.
|
|
77
|
+
|
|
78
|
+
### Changed
|
|
79
|
+
- The Diff extension now uses the shared attribute-access helper (consistent string/symbol handling with the rest of the library).
|
|
80
|
+
- Exclude the `assets/` directory from the packaged gem.
|
|
81
|
+
|
|
82
|
+
## [2.3.0] - 2020-09-06
|
|
83
|
+
### Added
|
|
84
|
+
- Options for slicing attribute data (extends the `#attributes(*names)` API introduced in 1.2.0 with the `with:` / `without:` selectors).
|
|
85
|
+
- `Micro::Attributes::Utils::Hashes.symbolize_keys`.
|
|
86
|
+
|
|
87
|
+
## [2.2.0] - 2020-09-02
|
|
88
|
+
### Added
|
|
89
|
+
- `attributes(...)` (plural) accepts a trailing options hash, so multiple attributes can share the same options in a single declaration (issue #26).
|
|
90
|
+
|
|
91
|
+
### Changed
|
|
92
|
+
- Prefer reader methods over hash accessors inside `#extract_attributes_from` (issue #24).
|
|
93
|
+
- Only accept `Proc` objects (not arbitrary callables) where a callable was previously allowed.
|
|
94
|
+
|
|
95
|
+
## [2.1.1] - 2020-08-28
|
|
96
|
+
### Fixed
|
|
97
|
+
- Fix the `activemodel_validations` extension.
|
|
98
|
+
|
|
99
|
+
## [2.1.0] - 2020-08-22
|
|
100
|
+
### Added
|
|
101
|
+
- Public `#defined_attributes` exposing the attribute schema of an instance.
|
|
102
|
+
- `Micro::Attributes::Utils::HashAccess` so the library can access hashes with either string or symbol keys.
|
|
103
|
+
- `required: true` attribute option that fails initialization when the attribute is missing.
|
|
104
|
+
|
|
105
|
+
### Changed
|
|
106
|
+
- Performance: small refactor of `Features::Initialize::Strict`.
|
|
107
|
+
|
|
108
|
+
## [2.0.1] - 2020-08-21
|
|
109
|
+
### Fixed
|
|
110
|
+
- Fix attribute assignment when the value is `false` (was being treated as missing).
|
|
111
|
+
|
|
112
|
+
### Changed
|
|
113
|
+
- Update gemspec summary and description.
|
|
114
|
+
|
|
115
|
+
## [2.0.0] - 2020-08-20
|
|
116
|
+
Major rewrite consolidating the redesign of the macro API and the features layer.
|
|
117
|
+
|
|
118
|
+
### Changed
|
|
119
|
+
- **BREAKING:** Default values are now declared via the `default:` keyword (e.g. `attribute :name, default: 'foo'`) instead of a positional argument. Defaults can be callables, in which case they're invoked at assignment time.
|
|
120
|
+
- **BREAKING:** Multiple-attribute declarations (`attributes(...)`) raise when an argument is not a `String`/`Symbol`, and a `Hash` argument is no longer allowed in the macro list.
|
|
121
|
+
- **BREAKING:** Renamed `Features::StrictInitialize` to `Features::Initialize::Strict`; the strict initializer is now an option of the `:initialize` feature rather than a standalone feature.
|
|
122
|
+
- **BREAKING:** Bumped the `kind` runtime dependency to `>= 3.0, < 5.0` (was `~> 1.0`); the strict-type checks now go through the new `kind` API.
|
|
123
|
+
- Switched the public API surface to single-quoted strings throughout; the gemspec `required_ruby_version` was bumped to `>= 2.2.0`.
|
|
124
|
+
- `Micro::Attributes.with` / `.without` were refactored, and `bundler` was added as a runtime dependency (later removed).
|
|
125
|
+
|
|
126
|
+
### Added
|
|
127
|
+
- `Micro::Attributes.with_all_features` shortcut.
|
|
128
|
+
- New `Micro::Attributes::Diff` namespace (extracted from the Diff feature so the diff API can be used outside the extension).
|
|
129
|
+
- `Micro::Attributes::Utils` replacing the old `Micro::Attributes::Hash` / `AttributesUtils` modules.
|
|
130
|
+
- Attribute options when the `ActiveModel::Validations` extension is enabled (validation directives can be declared inline on the attribute).
|
|
131
|
+
- Ruby 2.7 in the test matrix.
|
|
132
|
+
|
|
133
|
+
### Removed
|
|
134
|
+
- **BREAKING:** The `attributes!` method.
|
|
135
|
+
- The internal `Micro::Attributes::Hash` / `AttributesUtils` modules (superseded by `Micro::Attributes::Utils`).
|
|
136
|
+
|
|
137
|
+
## [1.2.0] - 2019-08-08
|
|
138
|
+
### Added
|
|
139
|
+
- `#attributes(*names)` accepts a list of attribute names and returns just that slice of the data.
|
|
140
|
+
|
|
141
|
+
## [1.1.1] - 2019-08-05
|
|
142
|
+
### Fixed
|
|
143
|
+
- Fix feature loading when all the `:initialize` options are used together.
|
|
144
|
+
|
|
145
|
+
## [1.1.0] - 2019-08-04
|
|
146
|
+
### Added
|
|
147
|
+
- `Micro::Attributes.without(...)` as the complement of `.with(...)`, returning the module that mixes in every feature *except* the listed ones.
|
|
148
|
+
- `Micro::Attributes.features()` (called without arguments) returns a module with all features wired in.
|
|
149
|
+
|
|
150
|
+
### Changed
|
|
151
|
+
- Deduplicate the StrictInitialize combination paths and remove the `included` hook from the strict initializer.
|
|
152
|
+
- Internal refactor to reduce cognitive complexity of the features module.
|
|
153
|
+
|
|
154
|
+
## [1.0.1] - 2019-07-31
|
|
155
|
+
### Changed
|
|
156
|
+
- Ignore duplicated feature options passed to `Micro::Attributes.with(...)`.
|
|
157
|
+
|
|
158
|
+
## [1.0.0] - 2019-07-29
|
|
159
|
+
First stable release.
|
|
160
|
+
|
|
161
|
+
### Added
|
|
162
|
+
- `Micro::Attributes.feature()` (singular) returning a single feature module.
|
|
163
|
+
- New **strict initializer** feature: `Micro::Attributes.with(:strict_initialize)` forbids missing keywords when constructing an object.
|
|
164
|
+
- `Micro::Attributes::Features.options()` utility helper.
|
|
165
|
+
|
|
166
|
+
### Changed
|
|
167
|
+
- Refactor `Micro::Attributes#attributes=`.
|
|
168
|
+
|
|
169
|
+
### Fixed
|
|
170
|
+
- Adjust the strict-initialize error-message assertion for Ruby < 2.3.
|
|
171
|
+
|
|
172
|
+
## [0.14.0] - 2019-07-26
|
|
173
|
+
### Added
|
|
174
|
+
- `Micro::Attributes.feature()` (singular) accessor.
|
|
175
|
+
|
|
176
|
+
### Changed
|
|
177
|
+
- README table of contents.
|
|
178
|
+
|
|
179
|
+
## [0.13.0] - 2019-07-10
|
|
180
|
+
### Added
|
|
181
|
+
- `Micro::Attributes::Diff` now returns a `from`/`to` pair for every entry in `Diff#differences`.
|
|
182
|
+
- New namespace grouping the "all-features" combinations.
|
|
183
|
+
|
|
184
|
+
### Changed
|
|
185
|
+
- Use frozen string literal constants throughout the library.
|
|
186
|
+
|
|
187
|
+
## [0.12.0] - 2019-07-10
|
|
188
|
+
### Changed
|
|
189
|
+
- `Micro::Attributes.features()` returns all features when invoked without arguments.
|
|
190
|
+
|
|
191
|
+
## [0.11.0] - 2019-07-10
|
|
192
|
+
### Added
|
|
193
|
+
- New **`ActiveModel::Validations`** feature (`Micro::Attributes.with(:activemodel_validations)`); CI matrix expanded to run against multiple `activemodel` versions.
|
|
194
|
+
|
|
195
|
+
### Removed
|
|
196
|
+
- `minitest` as a development dependency (now picked up transitively).
|
|
197
|
+
|
|
198
|
+
## [0.10.0] - 2019-07-09
|
|
199
|
+
### Added
|
|
200
|
+
- `Micro::Attributes.features()` entry point and the `Features` namespace.
|
|
201
|
+
- New **Diff** mixin (`Micro::Attributes::Differ`) exposing the differences between two instances; requires both sides to be of the same object type.
|
|
202
|
+
|
|
203
|
+
### Changed
|
|
204
|
+
- Renamed `ToInitialize` / `Differ` and moved them under the `Features` namespace; `ToInitialize` is now a public constant.
|
|
205
|
+
- Optimize `Micro::Attributes#attributes`.
|
|
206
|
+
|
|
207
|
+
## [0.9.0] - 2019-07-07
|
|
208
|
+
### Changed
|
|
209
|
+
- **BREAKING:** Changed the arity/behavior of the `.attribute` and `.attribute!` macros (they no longer accept the old positional-default form — defaults move to the next release's `default:` keyword path).
|
|
210
|
+
- Refactor `Micro::Attributes` / `Micro::Attributes::Macros`.
|
|
211
|
+
|
|
212
|
+
## [0.8.0] - 2019-07-07
|
|
213
|
+
### Added
|
|
214
|
+
- New instance methods `#attribute()` and `#attribute!()` to read/override a single attribute on an instance.
|
|
215
|
+
- `Micro::Attributes.to_initialize()` now mixes in via a module instead of `class_eval` strings.
|
|
216
|
+
|
|
217
|
+
### Changed
|
|
218
|
+
- Forbid access to internal constants from outside the library.
|
|
219
|
+
- **Gem renamed from `micro-attributes` to `u-attributes`** (gemspec file renamed; README and Gemfile updated to match).
|
|
220
|
+
|
|
221
|
+
## [0.7.0] - 2019-07-07
|
|
222
|
+
### Changed
|
|
223
|
+
- Restrict the macros that redefine attributes (`.attribute!` / `.attributes!`) to subclasses only.
|
|
224
|
+
- Refactor `Micro::Attributes#attributes`.
|
|
225
|
+
|
|
226
|
+
## [0.6.1] - 2019-07-05
|
|
227
|
+
### Fixed
|
|
228
|
+
- Fix new-attribute definition when using the `.attribute(s)!` macros.
|
|
229
|
+
|
|
230
|
+
## [0.6.0] - 2019-07-05
|
|
231
|
+
### Added
|
|
232
|
+
- `.attribute!` / `.attributes!` macros for subclasses to override the default data of inherited attributes.
|
|
233
|
+
|
|
234
|
+
## [0.5.0] - 2019-07-04
|
|
235
|
+
### Changed
|
|
236
|
+
- `.attributes_data` now requires a `Hash` argument.
|
|
237
|
+
|
|
238
|
+
## [0.4.0] - 2019-07-03
|
|
239
|
+
### Changed
|
|
240
|
+
- Internal: optimize the way attribute data is fetched.
|
|
241
|
+
|
|
242
|
+
## [0.3.0] - 2019-07-03
|
|
243
|
+
### Added
|
|
244
|
+
- Validate the constructor input.
|
|
245
|
+
|
|
246
|
+
### Changed
|
|
247
|
+
- Pin a required Ruby version in the gemspec.
|
|
248
|
+
- Fix the assignment path used when building new instances via `with_attribute(s)`.
|
|
249
|
+
|
|
250
|
+
## [0.2.0] - 2019-07-02
|
|
251
|
+
### Added
|
|
252
|
+
- Gem published under the new name **`u-attributes`** (previously `micro-attributes`); the `Micro::Attributes` namespace is unchanged.
|
|
253
|
+
|
|
254
|
+
### Fixed
|
|
255
|
+
- Fix attribute definition with inheritance.
|
|
256
|
+
|
|
257
|
+
## [0.1.0] - 2019-07-02
|
|
258
|
+
### Added
|
|
259
|
+
- Initial release (published as `micro-attributes`).
|
|
260
|
+
- `Micro::Attributes` mixin with the `.attribute` / `.attributes` macros for declaring attributes on a plain Ruby object.
|
|
261
|
+
- Generated reader methods plus the `with_attribute` / `with_attributes` constructors that return a new instance with the updated values (no setters).
|
|
262
|
+
|
|
263
|
+
[3.0.2]: https://github.com/serradura/u-attributes/compare/v3.0.1...v3.0.2
|
|
264
|
+
[3.0.1]: https://github.com/serradura/u-attributes/compare/v3.0.0...v3.0.1
|
|
265
|
+
[3.0.0]: https://github.com/serradura/u-attributes/compare/v2.8.0...v3.0.0
|
|
266
|
+
[2.8.0]: https://github.com/serradura/u-attributes/compare/v2.7.0...v2.8.0
|
|
267
|
+
[2.7.0]: https://github.com/serradura/u-attributes/compare/v2.6.0...v2.7.0
|
|
268
|
+
[2.6.0]: https://github.com/serradura/u-attributes/compare/v2.5.0...v2.6.0
|
|
269
|
+
[2.5.0]: https://github.com/serradura/u-attributes/compare/v2.4.0...v2.5.0
|
|
270
|
+
[2.4.0]: https://github.com/serradura/u-attributes/compare/v2.3.0...v2.4.0
|
|
271
|
+
[2.3.0]: https://github.com/serradura/u-attributes/compare/v2.2.0...v2.3.0
|
|
272
|
+
[2.2.0]: https://github.com/serradura/u-attributes/compare/v2.1.1...v2.2.0
|
|
273
|
+
[2.1.1]: https://github.com/serradura/u-attributes/compare/v2.1.0...v2.1.1
|
|
274
|
+
[2.1.0]: https://github.com/serradura/u-attributes/compare/v2.0.1...v2.1.0
|
|
275
|
+
[2.0.1]: https://github.com/serradura/u-attributes/compare/v2.0.0...v2.0.1
|
|
276
|
+
[2.0.0]: https://github.com/serradura/u-attributes/compare/v1.2.0...v2.0.0
|
|
277
|
+
[1.2.0]: https://github.com/serradura/u-attributes/compare/v1.1.1...v1.2.0
|
|
278
|
+
[1.1.1]: https://github.com/serradura/u-attributes/compare/v1.1.0...v1.1.1
|
|
279
|
+
[1.1.0]: https://github.com/serradura/u-attributes/compare/v1.0.1...v1.1.0
|
|
280
|
+
[1.0.1]: https://github.com/serradura/u-attributes/compare/v1.0.0...v1.0.1
|
|
281
|
+
[1.0.0]: https://github.com/serradura/u-attributes/compare/v0.14.0...v1.0.0
|
|
282
|
+
[0.14.0]: https://github.com/serradura/u-attributes/compare/v0.13.0...v0.14.0
|
|
283
|
+
[0.13.0]: https://github.com/serradura/u-attributes/compare/v0.12.0...v0.13.0
|
|
284
|
+
[0.12.0]: https://github.com/serradura/u-attributes/compare/v0.11.0...v0.12.0
|
|
285
|
+
[0.11.0]: https://github.com/serradura/u-attributes/compare/v0.10.0...v0.11.0
|
|
286
|
+
[0.10.0]: https://github.com/serradura/u-attributes/compare/v0.9.0...v0.10.0
|
|
287
|
+
[0.9.0]: https://github.com/serradura/u-attributes/compare/v0.8.0...v0.9.0
|
|
288
|
+
[0.8.0]: https://github.com/serradura/u-attributes/compare/v0.7.0...v0.8.0
|
|
289
|
+
[0.7.0]: https://github.com/serradura/u-attributes/compare/v0.6.1...v0.7.0
|
|
290
|
+
[0.6.1]: https://github.com/serradura/u-attributes/compare/v0.6.0...v0.6.1
|
|
291
|
+
[0.6.0]: https://github.com/serradura/u-attributes/compare/v0.5.0...v0.6.0
|
|
292
|
+
[0.5.0]: https://github.com/serradura/u-attributes/compare/v0.4.0...v0.5.0
|
|
293
|
+
[0.4.0]: https://github.com/serradura/u-attributes/compare/v0.3.0...v0.4.0
|
|
294
|
+
[0.3.0]: https://github.com/serradura/u-attributes/compare/v0.2.0...v0.3.0
|
|
295
|
+
[0.2.0]: https://github.com/serradura/u-attributes/compare/v0.1.0...v0.2.0
|
|
296
|
+
[0.1.0]: https://github.com/serradura/u-attributes/releases/tag/v0.1.0
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
Notes for AI assistants working in `u-attributes`.
|
|
4
|
+
|
|
5
|
+
## How to work in this repo
|
|
6
|
+
|
|
7
|
+
### 1. Think before coding
|
|
8
|
+
|
|
9
|
+
**Don't assume. Don't hide confusion. Surface tradeoffs.**
|
|
10
|
+
|
|
11
|
+
- State assumptions explicitly. If uncertain, ask.
|
|
12
|
+
- If multiple interpretations exist, present them — don't pick silently.
|
|
13
|
+
- If a simpler approach exists, say so. Push back when warranted.
|
|
14
|
+
- If something is unclear, stop. Name what's confusing. Ask.
|
|
15
|
+
|
|
16
|
+
### 2. Simplicity first
|
|
17
|
+
|
|
18
|
+
**Minimum code that solves the problem. Nothing speculative.**
|
|
19
|
+
|
|
20
|
+
- No features beyond what was asked.
|
|
21
|
+
- No abstractions for single-use code.
|
|
22
|
+
- No "flexibility" or "configurability" that wasn't requested.
|
|
23
|
+
- No error handling for impossible scenarios.
|
|
24
|
+
- If you write 200 lines and it could be 50, rewrite it.
|
|
25
|
+
|
|
26
|
+
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes,
|
|
27
|
+
simplify.
|
|
28
|
+
|
|
29
|
+
### 3. Surgical changes
|
|
30
|
+
|
|
31
|
+
**Touch only what you must. Clean up only your own mess.**
|
|
32
|
+
|
|
33
|
+
- Don't "improve" adjacent code, comments, or formatting.
|
|
34
|
+
- Don't refactor things that aren't broken.
|
|
35
|
+
- Match existing style, even if you'd do it differently.
|
|
36
|
+
- If you notice unrelated dead code, mention it — don't delete it.
|
|
37
|
+
- Remove imports/variables/functions that _your_ changes orphaned. Don't
|
|
38
|
+
remove pre-existing dead code unless asked.
|
|
39
|
+
|
|
40
|
+
The test: every changed line should trace directly to the user's request.
|
|
41
|
+
|
|
42
|
+
### 4. Goal-driven execution
|
|
43
|
+
|
|
44
|
+
**Define success criteria. Loop until verified.**
|
|
45
|
+
|
|
46
|
+
Turn vague tasks into verifiable goals:
|
|
47
|
+
|
|
48
|
+
- "Add validation" → "Write tests for invalid inputs, then make them pass"
|
|
49
|
+
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
|
|
50
|
+
- "Refactor X" → "Ensure tests pass before and after"
|
|
51
|
+
|
|
52
|
+
For multi-step work, state a brief plan with a verification check per step.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## What this is
|
|
57
|
+
|
|
58
|
+
`u-attributes` is a Ruby gem (originally published as `micro-attributes`) for
|
|
59
|
+
defining "immutable" objects: classes get attribute readers (no setters), and
|
|
60
|
+
mutation happens via `#with_attribute` / `#with_attributes` constructors that
|
|
61
|
+
return a new instance. Entry points live under `lib/micro/attributes`
|
|
62
|
+
(`Micro::Attributes`, the `.attribute` / `.attributes` macros, and the opt-in
|
|
63
|
+
features under `Micro::Attributes.with(...)` — `:initialize` (+ strict mode),
|
|
64
|
+
`:diff`, `:accept`, `:keys_as_symbol`, `:activemodel_validations`). It is a
|
|
65
|
+
runtime dependency of sibling gems like `u-case`, so behavior changes — and
|
|
66
|
+
especially anything that affects the public API or the supported `ruby` /
|
|
67
|
+
`activemodel` / `kind` matrix — are highly visible to downstream users.
|
|
68
|
+
|
|
69
|
+
## Running tests
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
bundle exec rake test # default suite, current bundle (no activemodel)
|
|
73
|
+
bundle exec appraisal <name> rake test # one Rails appraisal (see Appraisals)
|
|
74
|
+
bundle exec rake matrix # full local matrix for the active Ruby
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`bin/setup` re-installs and refreshes appraisals. `bin/matrix` reinstalls then
|
|
78
|
+
runs `rake matrix`. CI runs the matrix across the full Ruby × Rails grid plus
|
|
79
|
+
a no-`activemodel` baseline job. Tests are the success criterion for any
|
|
80
|
+
behavior change — write or update a test first, then make it pass (rule 4).
|
|
81
|
+
|
|
82
|
+
## CHANGELOG and README are part of every change
|
|
83
|
+
|
|
84
|
+
Both files are user-facing — keep them in sync with the code:
|
|
85
|
+
|
|
86
|
+
- **`CHANGELOG.md`**: follows [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/).
|
|
87
|
+
Every user-visible change (new macro/option, behavior change, breaking
|
|
88
|
+
change, dep bump that shifts the supported matrix, security fix) gets a
|
|
89
|
+
bullet under the appropriate section (`Added` / `Changed` / `Deprecated` /
|
|
90
|
+
`Removed` / `Fixed` / `Security`). Pure README/CI/internal-refactor changes
|
|
91
|
+
generally don't need an entry.
|
|
92
|
+
- **`README.md`**: the **Documentation** table and the **Compatibility** table
|
|
93
|
+
at the top reference the latest released version and its dependency bounds.
|
|
94
|
+
If you change a documented API, update the README in the same commit.
|
|
95
|
+
|
|
96
|
+
## Bumping the version
|
|
97
|
+
|
|
98
|
+
1. Edit `lib/micro/attributes/version.rb` — change `Micro::Attributes::VERSION`.
|
|
99
|
+
Follow [SemVer](https://semver.org/): patch for fixes, minor for additive
|
|
100
|
+
user-visible changes, major for breaking changes.
|
|
101
|
+
2. Add a new top entry in `CHANGELOG.md` (`## [X.Y.Z] - YYYY-MM-DD`) and a
|
|
102
|
+
matching compare link at the bottom (`[X.Y.Z]: …/compare/vPREV...vX.Y.Z`).
|
|
103
|
+
3. Update the README:
|
|
104
|
+
- **Documentation** table → bump the `v3.x` (or current major) row's
|
|
105
|
+
version label.
|
|
106
|
+
- **Compatibility** table → if dependency bounds changed, add a new row;
|
|
107
|
+
otherwise bump the existing row's version label.
|
|
108
|
+
4. If `Gemfile`/`u-attributes.gemspec` dependency bounds moved (currently
|
|
109
|
+
`kind >= 4.0, < 7.0` and `required_ruby_version >= 2.7.0`), double-check
|
|
110
|
+
the Compatibility table and `Appraisals` reflect the new bounds.
|
|
111
|
+
|
|
112
|
+
Don't tag, push, or `gem release` — humans do that.
|
data/README.md
CHANGED
|
@@ -21,7 +21,7 @@ So, if you change [[1](#with_attribute)] [[2](#with_attributes)] an attribute of
|
|
|
21
21
|
Version | Documentation
|
|
22
22
|
---------- | -------------
|
|
23
23
|
unreleased | https://github.com/serradura/u-attributes/blob/main/README.md
|
|
24
|
-
3.0.
|
|
24
|
+
3.0.2 | https://github.com/serradura/u-attributes/blob/v3.x/README.md
|
|
25
25
|
2.8.0 | https://github.com/serradura/u-attributes/blob/v2.x/README.md
|
|
26
26
|
|
|
27
27
|
# Table of contents <!-- omit in toc -->
|
|
@@ -85,7 +85,7 @@ gem 'u-attributes', '~> 3.0'
|
|
|
85
85
|
| u-attributes | branch | ruby | activemodel |
|
|
86
86
|
| ---------------- | ------ | -------- | -------------- |
|
|
87
87
|
| unreleased | main | >= 2.7 | >= 6.0 |
|
|
88
|
-
| 3.0.
|
|
88
|
+
| 3.0.2 | v3.x | >= 2.7 | >= 6.0 |
|
|
89
89
|
| 2.8.0 | v2.x | >= 2.2.0 | >= 3.2, <= 8.1 |
|
|
90
90
|
|
|
91
91
|
This library is tested (CI matrix) against:
|
data/u-attributes.gemspec
CHANGED
|
@@ -16,6 +16,10 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
spec.homepage = 'https://github.com/serradura/u-attributes'
|
|
17
17
|
spec.license = 'MIT'
|
|
18
18
|
|
|
19
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
|
20
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
|
21
|
+
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
|
|
22
|
+
|
|
19
23
|
# Specify which files should be added to the gem when it is released.
|
|
20
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
21
25
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: u-attributes
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rodrigo Serradura
|
|
@@ -84,6 +84,8 @@ files:
|
|
|
84
84
|
- ".gitignore"
|
|
85
85
|
- ".vscode/settings.json"
|
|
86
86
|
- Appraisals
|
|
87
|
+
- CHANGELOG.md
|
|
88
|
+
- CLAUDE.md
|
|
87
89
|
- CODE_OF_CONDUCT.md
|
|
88
90
|
- Gemfile
|
|
89
91
|
- LICENSE.txt
|
|
@@ -112,7 +114,10 @@ files:
|
|
|
112
114
|
homepage: https://github.com/serradura/u-attributes
|
|
113
115
|
licenses:
|
|
114
116
|
- MIT
|
|
115
|
-
metadata:
|
|
117
|
+
metadata:
|
|
118
|
+
changelog_uri: https://github.com/serradura/u-attributes/blob/main/CHANGELOG.md
|
|
119
|
+
source_code_uri: https://github.com/serradura/u-attributes
|
|
120
|
+
bug_tracker_uri: https://github.com/serradura/u-attributes/issues
|
|
116
121
|
rdoc_options: []
|
|
117
122
|
require_paths:
|
|
118
123
|
- lib
|
|
@@ -127,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
127
132
|
- !ruby/object:Gem::Version
|
|
128
133
|
version: '0'
|
|
129
134
|
requirements: []
|
|
130
|
-
rubygems_version: 4.0.
|
|
135
|
+
rubygems_version: 4.0.12
|
|
131
136
|
specification_version: 4
|
|
132
137
|
summary: Create "immutable" objects with no setters, just getters.
|
|
133
138
|
test_files: []
|