adornment-core 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9f458840898b3e988db4d7dc782b341c2cccacb1b4d5a80632d8dab3f948f586
4
+ data.tar.gz: f598bf3f4d8845a5396f58dbfc5e4a2f25c7e4318897a6ee20353eaa1a1193e5
5
+ SHA512:
6
+ metadata.gz: 0a96f3c797b9625c967ffe52e7077daadc524a9f92bef0784569616e9c76ce146b85e831f6f25aa0393c0cdcefeadf81c72e70e9c1747e14e9b4ddf549d197bb
7
+ data.tar.gz: bb8039fa461fa4dc9f1f1d1f6fe2c0916aae2106061bbd22773ba90da01907711b831f084adecfd9c3726da9b9448a0c95af0401de4b91d12d08d37427c5df23
data/CHANGELOG.md ADDED
@@ -0,0 +1,34 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-10-20)
4
+
5
+ First release of `adornment-core`, the annotation engine behind Adornment.
6
+
7
+ - **Annotation types** are named plain classes that include `Adornment::Annotation[...]`, with
8
+ the policies `repeatable:` (default `false`) and `targets:` (default
9
+ `[:instance, :singleton]`). Fields are instance variables set by an ordinary `initialize`, so
10
+ Ruby's own rules decide positional, keyword, required and default arguments. `new` deep-freezes
11
+ copies of Array, Hash, Set and String fields and freezes the instance. Instances compare, hash,
12
+ convert (`to_h`), inspect and pattern-match by class and fields.
13
+ - **Declarations** above `def`: `include Adornment[Traced, Cache: Cached]` defines declaration
14
+ methods (`Traced(...)`) on the owner, `adorn instance` declares without them, and
15
+ `extend Adornment::Core::Target` + `use_annotations` is the explicit form. Pending
16
+ declarations attach to the owner's next method definition from the same fiber: `def`,
17
+ `define_method`, `def self.x`, `attr_*` (first name), aliases, `module_function` copies and
18
+ visibility changes of inherited methods.
19
+ - **Attachment-time validation**: `Annotation#validate(site)` with `Adornment::Core::Site`; a
20
+ failure raises `Adornment::DefinitionError` (the validator's error as `cause`) and attaches
21
+ nothing.
22
+ - **Reflection** along Ruby's method resolution, strict as in Java: `annotations_for`,
23
+ `annotation`, `find_annotation` (walks overridden methods), `annotated_with`,
24
+ `own_annotations_for`, `own_annotated_methods`, `declarations_for`, `pending_adornments`.
25
+ Includers, prependers and extenders of activated modules get the read-only API.
26
+ - **Discovery and verification**: `Adornment.annotated_with`, `registered_owners` (weak registry),
27
+ `unregister`, `verify_all!`, `Owner.verify_adornments!`. Leftover declarations raise
28
+ `Adornment::LeftoverAnnotations` on a declaration for another owner, on a constant added to the
29
+ owner, or at verification. Nothing is traced.
30
+ - **Lint** for bare annotation constants (`Traced` instead of `Traced()`), parsed with Prism and
31
+ loaded only on first use.
32
+ - `Adornment.immutable_copy` and `Type.short_name` for extension gems.
33
+ - Never wraps or replaces methods: a call to an annotated method runs no Adornment code and
34
+ allocates nothing extra. Pure Ruby, no runtime dependencies, CRuby >= 3.3.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yaroslav Zahoruiko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.