rucy 0.3.9 → 0.3.10
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/CLAUDE.md +23 -0
- data/ChangeLog.md +6 -0
- data/VERSION +1 -1
- data/include/rucy/value.h.erb +5 -5
- data/lib/rucy/extension.rb +4 -0
- data/lib/rucy/rake.rb +2 -2
- data/rucy.gemspec +1 -1
- data/src/value.cpp.erb +14 -23
- metadata +5 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e8cd9f7debbf5cc0cdda96233df3fcc23bf73ad3350c76a99b3c0b7961258fa1
|
|
4
|
+
data.tar.gz: eae9388c7411987181b919e9bce98744bd532555969c5cb68e65b2baa9263ec3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9dbfe36a20c69cef98f72af08e9df2ea669de273d4c00590f911fd58ca3e818156b38deaa2d162fbba2122002c5e6c039ef5af67feffd49fa24cbb9e2f0fcaa1
|
|
7
|
+
data.tar.gz: a6742444cca68e8e2b5b2ec9c62b34391bd7930f3477bb6d899a29a68cc073c81de231092956b0a7df7eade9b89212a6849268c100ee84a49bfd4fb63805aefb
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Rucy
|
|
2
|
+
|
|
3
|
+
Ruby C++ Extension Helper Library. Reduces boilerplate when writing Ruby extensions in C++.
|
|
4
|
+
|
|
5
|
+
## ERB Code Generation
|
|
6
|
+
|
|
7
|
+
`src/*.cpp.erb` and `include/rucy/*.h.erb` are ERB templates expanded at build time.
|
|
8
|
+
`NPARAM_MAX = 12` auto-generates function bindings for 0–12 parameters.
|
|
9
|
+
|
|
10
|
+
## Macro API
|
|
11
|
+
|
|
12
|
+
Define Ruby methods from C++ using dedicated macros:
|
|
13
|
+
```cpp
|
|
14
|
+
RUCY_DEF0(method_name)
|
|
15
|
+
{
|
|
16
|
+
// ...
|
|
17
|
+
}
|
|
18
|
+
RUCY_END
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Tools
|
|
22
|
+
|
|
23
|
+
- `bin/rucy2rdoc` — Converts C++ doc macros to RDoc format
|
data/ChangeLog.md
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.10
|
data/include/rucy/value.h.erb
CHANGED
|
@@ -62,8 +62,6 @@ namespace Rucy
|
|
|
62
62
|
|
|
63
63
|
Symbol as_sym (bool convert = false) const;
|
|
64
64
|
|
|
65
|
-
Value* as_array (bool convert = false);
|
|
66
|
-
|
|
67
65
|
const Value* as_array (bool convert = false) const;
|
|
68
66
|
|
|
69
67
|
Value to_i () const;
|
|
@@ -127,13 +125,15 @@ namespace Rucy
|
|
|
127
125
|
|
|
128
126
|
Value unshift (Value obj);
|
|
129
127
|
|
|
130
|
-
|
|
128
|
+
void set (size_t index, Value obj);
|
|
129
|
+
|
|
130
|
+
Value get (size_t index) const;
|
|
131
131
|
|
|
132
|
-
const Value& operator [] (size_t
|
|
132
|
+
const Value& operator [] (size_t index) const;
|
|
133
133
|
|
|
134
134
|
// Hash
|
|
135
135
|
|
|
136
|
-
void set (Value key, Value
|
|
136
|
+
void set (Value key, Value obj);
|
|
137
137
|
|
|
138
138
|
Value get (Value key) const;
|
|
139
139
|
|
data/lib/rucy/extension.rb
CHANGED
data/lib/rucy/rake.rb
CHANGED
data/rucy.gemspec
CHANGED
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
s.platform = Gem::Platform::RUBY
|
|
26
26
|
s.required_ruby_version = '>= 3.0.0'
|
|
27
27
|
|
|
28
|
-
s.add_dependency 'xot', '~> 0.3.
|
|
28
|
+
s.add_dependency 'xot', '~> 0.3.10'
|
|
29
29
|
|
|
30
30
|
s.files = `git ls-files`.split $/
|
|
31
31
|
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
|
data/src/value.cpp.erb
CHANGED
|
@@ -176,12 +176,6 @@ namespace Rucy
|
|
|
176
176
|
return as<Symbol>(convert);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
Value*
|
|
180
|
-
Value::as_array (bool convert)
|
|
181
|
-
{
|
|
182
|
-
return as<Value*>(convert);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
179
|
const Value*
|
|
186
180
|
Value::as_array (bool convert) const
|
|
187
181
|
{
|
|
@@ -351,23 +345,29 @@ namespace Rucy
|
|
|
351
345
|
return rb_ary_unshift(value(), obj.value());
|
|
352
346
|
}
|
|
353
347
|
|
|
354
|
-
|
|
355
|
-
Value::
|
|
348
|
+
void
|
|
349
|
+
Value::set (size_t index, Value obj)
|
|
350
|
+
{
|
|
351
|
+
rb_ary_store(value(), (long) index, obj.value());
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
Value
|
|
355
|
+
Value::get (size_t index) const
|
|
356
356
|
{
|
|
357
|
-
return
|
|
357
|
+
return operator[](index);
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
const Value&
|
|
361
|
-
Value::operator [] (size_t
|
|
361
|
+
Value::operator [] (size_t index) const
|
|
362
362
|
{
|
|
363
|
-
return
|
|
363
|
+
return as_array()[index];
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
void
|
|
367
|
-
Value::set (Value key, Value
|
|
367
|
+
Value::set (Value key, Value obj)
|
|
368
368
|
{
|
|
369
369
|
RUCY_SYMBOL(array_set, "[]=");
|
|
370
|
-
call(array_set, key,
|
|
370
|
+
call(array_set, key, obj);
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
Value
|
|
@@ -778,22 +778,13 @@ namespace Rucy
|
|
|
778
778
|
return SYM2ID(obj.value());
|
|
779
779
|
}
|
|
780
780
|
|
|
781
|
-
template <> Value*
|
|
782
|
-
value_to<Value*> (Value obj, bool convert)
|
|
783
|
-
{
|
|
784
|
-
if (convert) obj = obj.to_array();
|
|
785
|
-
check_type(obj, RUBY_T_ARRAY);
|
|
786
|
-
|
|
787
|
-
return (Value*) RARRAY_PTR(obj.value());
|
|
788
|
-
}
|
|
789
|
-
|
|
790
781
|
template <> const Value*
|
|
791
782
|
value_to<const Value*> (Value obj, bool convert)
|
|
792
783
|
{
|
|
793
784
|
if (convert) obj = obj.to_array();
|
|
794
785
|
check_type(obj, RUBY_T_ARRAY);
|
|
795
786
|
|
|
796
|
-
return (const Value*)
|
|
787
|
+
return (const Value*) RARRAY_CONST_PTR(obj.value());
|
|
797
788
|
}
|
|
798
789
|
|
|
799
790
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rucy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- xordog
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-04-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: xot
|
|
@@ -16,20 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.3.
|
|
20
|
-
- - ">="
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: 0.3.9
|
|
19
|
+
version: 0.3.10
|
|
23
20
|
type: :runtime
|
|
24
21
|
prerelease: false
|
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
23
|
requirements:
|
|
27
24
|
- - "~>"
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 0.3.
|
|
30
|
-
- - ">="
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: 0.3.9
|
|
26
|
+
version: 0.3.10
|
|
33
27
|
description: This library helps you to develop Ruby Extension by C++.
|
|
34
28
|
email: xordog@gmail.com
|
|
35
29
|
executables:
|
|
@@ -55,6 +49,7 @@ files:
|
|
|
55
49
|
- ".github/workflows/tag.yml"
|
|
56
50
|
- ".github/workflows/test.yml"
|
|
57
51
|
- ".github/workflows/utils.rb"
|
|
52
|
+
- CLAUDE.md
|
|
58
53
|
- CONTRIBUTING.md
|
|
59
54
|
- ChangeLog.md
|
|
60
55
|
- Gemfile
|