xot 0.3.12 β†’ 0.3.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95e3e82cc5f95bba59970fbe97e36e28e4f2a454e4cd4e1faf0ecf4ef1937be7
4
- data.tar.gz: 84f576eaa74fbd89e6f029a31ab1fdccf3b59fc64ce4d574191051d445736047
3
+ metadata.gz: 9b42a573c90d9544aae23f3fe0768c88205bea55ca9279b68e794fd6067d7671
4
+ data.tar.gz: 4f3c4072b4c446d4b2afa46226df1f8e2101717951f274913b4a2ed81ae8dc39
5
5
  SHA512:
6
- metadata.gz: ade52d927ea1a92a9a63dfa73ad98caf2868415accf4b0691328eced45aefe7bda9e9beead0ea3cf0329316f46635c7e7af1330b9a3fd2402bec2da8c05fb6a6
7
- data.tar.gz: 783a40a3f5dfc1b4ce49eb578713ea74c0e1d7062b6b784914f208c1b02f20bbd89531c9ec965b1bebe194e587bbdc5d0da6c6b53606c8b5421d025e60a49c01
6
+ metadata.gz: 0c98011d4d8e0b8a8f31365af23d52ce1f170abacd1edbc8b704cbf098da6e4f174f41e24a54d819e7816499fd801c9a09ef33283cefaad127e443fff9cacb0c
7
+ data.tar.gz: 1c73c446d67a45360c08b4db4f6de67a5330d1d320f4cc8fd5badf5f1758391b35dbbb2d74e49c529dacbf3c876c438e787153827630f3c6e29b5da409383eb0
@@ -36,23 +36,9 @@ jobs:
36
36
  echo path=$(ruby -e 'print Dir.glob("*.gem").first') >> $GITHUB_OUTPUT
37
37
 
38
38
  - name: create github release
39
- id: release
40
- uses: actions/create-release@v1
41
39
  env:
42
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43
- with:
44
- tag_name: ${{ github.ref }}
45
- release_name: ${{ github.ref }}
46
-
47
- - name: upload to github release
48
- uses: actions/upload-release-asset@v1
49
- env:
50
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51
- with:
52
- upload_url: ${{ steps.release.outputs.upload_url }}
53
- asset_path: ./${{ steps.gem.outputs.path }}
54
- asset_name: ${{ steps.gem.outputs.path }}
55
- asset_content_type: application/zip
40
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41
+ run: ruby -I.github/workflows -rutils -e 'release(*ARGV)' ./${{ steps.gem.outputs.path }}
56
42
 
57
43
  - name: upload to rubygems
58
44
  env:
data/ChangeLog.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # xot ChangeLog
2
2
 
3
3
 
4
+ ## [v0.3.13] - 2026-05-17
5
+
6
+ - Rewrite README.md
7
+ - CI: Migrate release-gem.yml from actions/create-release to gh release create
8
+
9
+
4
10
  ## [v0.3.12] - 2026-05-10
5
11
 
6
12
  - Add hint_memory_usage callback for external memory GC integration
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Xot - Some useful utility classes and functions
1
+ # Xot - Shared utility classes and functions for C++ and Ruby
2
2
 
3
3
  [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/xord/xot)
4
4
  ![License](https://img.shields.io/github/license/xord/xot)
@@ -21,20 +21,29 @@ Thanks for your support! πŸ™Œ
21
21
 
22
22
  ## πŸš€ About
23
23
 
24
- **Xot** is a small utility library that was extracted for internal use to provide basic helper classes and functions across our own Ruby gems.
24
+ **Xot** is the foundational utility layer used by every other library in the `xord/*` family β€” Rucy, Beeps, Rays, Reflex, Processing, RubySketch, and Reight.
25
25
 
26
- It’s not intended for general public use, but rather serves as a simple collection of utilities to make our own development process more efficient and consistent.
26
+ It is split into two layers that ship in a single gem:
27
27
 
28
- Feel free to explore, but please note that it’s not actively maintained or intended for broad adoption.
28
+ - **C++ headers and library** (`include/xot/`, `src/`) β€” building blocks such as reference counting, the pimpl idiom, non-copyable base, plus thin wrappers for strings, time, exceptions, and debug output. These are linked into the native extensions of the other `xord/*` gems.
29
+ - **Ruby helpers** (`lib/xot/`) β€” small meta-programming mixins (`Hookable`, `Inspectable`, accessor builders, ...), bit-flag utilities, and shared Rake / test scaffolding used by our gems.
30
+
31
+ Xot exists primarily to keep these patterns consistent across our own projects. It is not designed as a general-purpose dependency, and its API is not promised to be stable for outside use. You are welcome to read and learn from it, but pin a specific version if you depend on it directly.
32
+
33
+ ## πŸ“‹ Requirements
34
+
35
+ - Ruby **3.0.0** or later
36
+ - A C++ compiler with C++20 support (Clang on macOS / iOS, GCC or MSVC on Linux / Windows)
37
+ - [Rake](https://rubygems.org/gems/rake) and [test-unit](https://rubygems.org/gems/test-unit) (development only)
29
38
 
30
39
  ## πŸ“¦ Installation
31
40
 
32
41
  Add this line to your Gemfile:
33
42
  ```ruby
34
- $ gem 'xot'
43
+ gem 'xot'
35
44
  ```
36
45
 
37
- Then, install gem:
46
+ Then install:
38
47
  ```bash
39
48
  $ bundle install
40
49
  ```
@@ -44,6 +53,145 @@ Or install it directly:
44
53
  $ gem install xot
45
54
  ```
46
55
 
56
+ When installed via `gem install`, the C++ headers under `include/xot/` are placed inside the gem directory so that other `xord/*` extensions can locate them at build time (via `Xot::Extension.inc_dir`).
57
+
58
+ ## πŸ“š What's Included
59
+
60
+ ### C++ headers (`include/xot/`)
61
+
62
+ | Header | Provides |
63
+ | ---------------- | ------------------------------------------------------------------------ |
64
+ | `defs.h` | Type aliases (`uint`, `ushort`, `ulong`, `schar`, `longlong`, ...) |
65
+ | `noncopyable.h` | `Xot::NonCopyable` β€” base class that disables copy and assignment |
66
+ | `ref.h` | `Xot::RefCountable<>` and `Xot::Ref<T>` β€” intrusive reference counting |
67
+ | `pimpl.h` | `Xot::PImpl<T>` / `Xot::PSharedImpl<T>` β€” pimpl idiom on top of smart ptrs |
68
+ | `string.h` | `Xot::String` (extends `std::string`), `stringf`, `split`, `to_s` |
69
+ | `time.h` | `Xot::time()` (seconds since epoch, double), `Xot::sleep(seconds)` |
70
+ | `exception.h` | `XotError` hierarchy and `xot_error` / `argument_error` / ... throw helpers |
71
+ | `debug.h` | `Xot::dout` / `doutln` β€” printf-style debug output (no-op in release) |
72
+ | `util.h` | Bit / flag helpers, `random`, `deg2rad`, `rad2deg`, memory-usage hints |
73
+ | `windows.h` | Win32 helpers used by other libraries |
74
+
75
+ ### Ruby modules (`lib/xot/`)
76
+
77
+ | Module / class | Purpose |
78
+ | --------------------------- | ----------------------------------------------------------------------- |
79
+ | `Xot::Hookable` | Attach `on_*` hook methods, or `before` / `after` wrappers around an existing method, on a single object |
80
+ | `Xot::Inspectable` | Compact default `inspect` (class + object_id only) β€” safe under circular references |
81
+ | `Xot::BitFlag` | Build symbolic bit-flag sets and convert between symbols and bitmasks |
82
+ | `Xot::BitFlagAccessor` | Class-level accessor generator backed by a `BitFlag` |
83
+ | `Xot::BitUtil` | Bit manipulation helpers (`bit(n)`, etc.) |
84
+ | `Xot::BlockUtil` | `instance_eval`-or-block-call dispatching |
85
+ | `Xot::ConstSymbolAccessor` | Define accessors that translate symbols to module constants |
86
+ | `Xot::UniversalAccessor` | Single-method getter / setter (`obj.x` reads, `obj.x value` writes) |
87
+ | `Xot::Setter` | Bulk attribute setter mixin |
88
+ | `Xot::Invoker` | Helper for invoking methods / blocks safely |
89
+ | `Xot::Util` | Misc Ruby utilities |
90
+ | `Xot::Extension` | Path / name / version helpers used by every `xord/*` gem's build script |
91
+ | `Xot::Rake` | Rake DSL (`default_tasks`, `build_native_library`, `build_ruby_extension`, `test_ruby_extension`, `build_ruby_gem`, ...) |
92
+ | `Xot::Test` | Test-unit helpers |
93
+
94
+ ## πŸ’‘ Usage
95
+
96
+ ### C++ β€” reference counting
97
+
98
+ ```cpp
99
+ #include <xot/ref.h>
100
+
101
+ class Thing : public Xot::RefCountable<>
102
+ {
103
+ protected:
104
+ ~Thing () = default; // destructor is protected; Ref<> handles deletion
105
+ };
106
+
107
+ Xot::Ref<Thing> a = new Thing; // refcount = 1
108
+ {
109
+ Xot::Ref<Thing> b = a; // refcount = 2
110
+ } // refcount = 1
111
+ // when `a` goes out of scope, refcount = 0 and the object is deleted
112
+ ```
113
+
114
+ ### C++ β€” pimpl
115
+
116
+ ```cpp
117
+ #include <xot/pimpl.h>
118
+
119
+ // in the header
120
+ class Widget
121
+ {
122
+ public:
123
+ Widget ();
124
+ int value () const;
125
+ private:
126
+ struct Data;
127
+ Xot::PImpl<Data> self;
128
+ };
129
+
130
+ // in the .cpp
131
+ struct Widget::Data { int n = 42; };
132
+ Widget::Widget () {}
133
+ int Widget::value () const { return self->n; }
134
+ ```
135
+
136
+ ### Ruby β€” `BitFlag`
137
+
138
+ ```ruby
139
+ require 'xot/bit_flag'
140
+
141
+ flags = Xot::BitFlag.new(read: 0x1, write: 0x2, exec: 0x4)
142
+ mask = flags.symbols2bits(:read, :exec) # => 5
143
+ flags.bits2symbols(mask) # => [:read, :exec]
144
+ ```
145
+
146
+ ### Ruby β€” `Hookable`
147
+
148
+ ```ruby
149
+ require 'xot/hookable'
150
+
151
+ class Greeter
152
+ include Xot::Hookable
153
+ def greet(name) = "hello, #{name}"
154
+ end
155
+
156
+ g = Greeter.new
157
+ g.before(:greet) {|name| puts "about to greet #{name}" }
158
+ g.greet 'world'
159
+ # => about to greet world
160
+ # => "hello, world"
161
+
162
+ # `on` creates a brand-new on_* method instead of wrapping an existing one
163
+ g.on(:click) {|x, y| puts "clicked at #{x}, #{y}" }
164
+ g.on_click 1, 2
165
+ ```
166
+
167
+ ### Ruby β€” `UniversalAccessor`
168
+
169
+ ```ruby
170
+ require 'xot/universal_accessor'
171
+
172
+ class Box
173
+ attr_accessor :width
174
+ universal_accessor :width
175
+ end
176
+
177
+ box = Box.new
178
+ box.width 10 # writes
179
+ box.width # => 10 (reads)
180
+ ```
181
+
182
+ ## πŸ› οΈ Development
183
+
184
+ Xot uses a shared Rakefile pattern. From the gem root:
185
+
186
+ ```bash
187
+ $ rake lib # build the native C++ library (libxot)
188
+ $ rake ext # build the Ruby C extension
189
+ $ rake test # run the test suite (test/test_*.rb)
190
+ $ rake # default: builds the extension
191
+ ```
192
+
193
+ In the [`xord/all`](https://github.com/xord/all) monorepo you can also scope by module, e.g. `rake xot test`.
194
+
47
195
  ## πŸ“œ License
48
196
 
49
197
  **Xot** is licensed under the MIT License.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.12
1
+ 0.3.13
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-09 00:00:00.000000000 Z
11
+ date: 2026-05-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This library include some useful utility classes and functions for development
14
14
  with C++.