rucy 0.3.9 → 0.3.11

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: 4cd4922f491902cd72f1b84a3a894ba1759df1db00021066f331267d500facfe
4
- data.tar.gz: 8516cc30e08380cafc6e48e0af6d53e0a175f0c045b15b13931dc85b8e2cf645
3
+ metadata.gz: 89db0f3be96a0564f5ed99044093f111decff6d0dd89a613251be1bda89163ca
4
+ data.tar.gz: 6c7b8d8aafc090fb75d7fb2c3cfc16fe9026b8da93d4673ee5cc9b3d8e2aba6e
5
5
  SHA512:
6
- metadata.gz: 0fc056a4b1ceaf00a16ecffb3a1e4433cffa9c1d3a6093e975c445b0f1f80590e8e6372aeacc6942cad0f01ca8f55dadd2dc149ad0ce6840116556c7385f828a
7
- data.tar.gz: a557b8a98e5a74eea2e07803fcf41b26c02441b362cc357f40cadcc2d207cb0153549262f10c5071aed3bda1e3fd2eeb4a6315f62f8768f4fc0dcca5ef1163b4
6
+ metadata.gz: a82fd0de0e5e372e8dbb25b335c3cb27e7209c691522058e26c324dfb16204b181c72326439e5f05c2a54ed7199fb23d5315f3a02b4f8de8d35533b1e9977036
7
+ data.tar.gz: 510edf2d681cc108435efc854c26446afc4560e7a0471269f68661bc6f8f9eedbf2c8d55ef2733dce46e78c1a01c5ca86b8dcb0c2b84723474a2d60cf2b3c885
@@ -24,7 +24,7 @@ jobs:
24
24
  run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
25
25
 
26
26
  - name: test
27
- run: bundle exec rake quiet packages test
27
+ run: bundle exec rake packages test
28
28
 
29
29
  - name: create gem
30
30
  id: gem
@@ -25,13 +25,13 @@ jobs:
25
25
  run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
26
26
 
27
27
  - name: packages
28
- run: bundle exec rake packages
28
+ run: bundle exec rake verbose packages
29
29
 
30
30
  - name: lib
31
- run: bundle exec rake lib
31
+ run: bundle exec rake verbose lib
32
32
 
33
33
  - name: ext
34
- run: bundle exec rake ext
34
+ run: bundle exec rake verbose ext
35
35
 
36
36
  - name: test
37
- run: bundle exec rake test
37
+ run: bundle exec rake verbose test
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
@@ -1,6 +1,17 @@
1
1
  # rucy ChangeLog
2
2
 
3
3
 
4
+ ## [v0.3.11] - 2026-04-17
5
+
6
+ - Fix ANYARGS function pointer warnings in module bindings
7
+
8
+
9
+ ## [v0.3.10] - 2026-04-09
10
+
11
+ - Remove non-const VALUE* operator[] from Value wrapper for arrays
12
+ - Update dependencies
13
+
14
+
4
15
  ## [v0.3.9] - 2025-07-06
5
16
 
6
17
  - Add deepwiki badge
data/Gemfile.lock CHANGED
@@ -1,15 +1,16 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- power_assert (2.0.3)
5
- rake (13.1.0)
6
- test-unit (3.6.1)
4
+ power_assert (3.0.1)
5
+ rake (13.3.1)
6
+ test-unit (3.7.7)
7
7
  power_assert
8
- yard (0.9.34)
8
+ yard (0.9.39)
9
9
 
10
10
  PLATFORMS
11
11
  arm64-darwin-21
12
12
  arm64-darwin-23
13
+ arm64-darwin-24
13
14
 
14
15
  DEPENDENCIES
15
16
  rake
@@ -17,4 +18,4 @@ DEPENDENCIES
17
18
  yard
18
19
 
19
20
  BUNDLED WITH
20
- 2.4.13
21
+ 2.4.19
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.9
1
+ 0.3.11
@@ -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
- Value& operator [] (size_t i);
128
+ void set (size_t index, Value obj);
129
+
130
+ Value get (size_t index) const;
131
131
 
132
- const Value& operator [] (size_t i) const;
132
+ const Value& operator [] (size_t index) const;
133
133
 
134
134
  // Hash
135
135
 
136
- void set (Value key, Value value);
136
+ void set (Value key, Value obj);
137
137
 
138
138
  Value get (Value key) const;
139
139
 
@@ -25,6 +25,10 @@ module Rucy
25
25
  root_dir 'lib'
26
26
  end
27
27
 
28
+ def ext_dir()
29
+ root_dir 'ext'
30
+ end
31
+
28
32
  end# Extension
29
33
 
30
34
 
data/lib/rucy/rake.rb CHANGED
@@ -8,11 +8,11 @@ module Rucy
8
8
 
9
9
 
10
10
  def rdoc()
11
- env :RDOC, 'rdoc'# 'yardoc'
11
+ get_env :RDOC, 'rdoc'# 'yardoc'
12
12
  end
13
13
 
14
14
  def rucy2rdoc()
15
- env :RUCY2RDOC, 'rucy2rdoc'
15
+ get_env :RUCY2RDOC, 'rucy2rdoc'
16
16
  end
17
17
 
18
18
  def generate_documents()
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.9', '>= 0.3.9'
28
+ s.add_dependency 'xot', '~> 0.3.11'
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/module.cpp.erb CHANGED
@@ -66,13 +66,15 @@ namespace Rucy
66
66
  void
67
67
  Module::<%= op %> (const char* name, RubyFunctionN fun)
68
68
  {
69
- <%= rb_op %>(value(), name, RUBY_METHOD_FUNC(fun), -1);
69
+ typedef VALUE (*Fun) (int, const VALUE*, VALUE);
70
+ <%= rb_op %>(value(), name, (Fun) fun, -1);
70
71
  }
71
72
  % NTIMES.each do |n|
72
73
  void
73
74
  Module::<%= op %> (const char* name, RubyFunction<%= n %> fun)
74
75
  {
75
- <%= rb_op %>(value(), name, RUBY_METHOD_FUNC(fun), <%= n %>);
76
+ typedef VALUE (*Fun) (<%= (['VALUE'] * (n + 1)).join(', ') %>);
77
+ <%= rb_op %>(value(), name, (Fun) fun, <%= n %>);
76
78
  }
77
79
  % end
78
80
  % end
@@ -100,14 +102,16 @@ namespace Rucy
100
102
  void
101
103
  define_function (const char* name, RubyFunctionN fun)
102
104
  {
103
- rb_define_global_function(name, RUBY_METHOD_FUNC(fun), -1);
105
+ typedef VALUE (*Fun) (int, const VALUE*, VALUE);
106
+ rb_define_global_function(name, (Fun) fun, -1);
104
107
  }
105
108
  % NTIMES.each do |n|
106
109
 
107
110
  void
108
111
  define_function (const char* name, RubyFunction<%= n %> fun)
109
112
  {
110
- rb_define_global_function(name, RUBY_METHOD_FUNC(fun), <%= n %>);
113
+ typedef VALUE (*Fun) (<%= (['VALUE'] * (n + 1)).join(', ') %>);
114
+ rb_define_global_function(name, (Fun) fun, <%= n %>);
111
115
  }
112
116
  % end
113
117
 
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
- Value&
355
- Value::operator [] (size_t i)
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 as_array()[i];
357
+ return operator[](index);
358
358
  }
359
359
 
360
360
  const Value&
361
- Value::operator [] (size_t i) const
361
+ Value::operator [] (size_t index) const
362
362
  {
363
- return const_cast<Value*>(this)->operator[](i);
363
+ return as_array()[index];
364
364
  }
365
365
 
366
366
  void
367
- Value::set (Value key, Value value)
367
+ Value::set (Value key, Value obj)
368
368
  {
369
369
  RUCY_SYMBOL(array_set, "[]=");
370
- call(array_set, key, value);
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*) RARRAY_PTR(obj.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.9
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-05 00:00:00.000000000 Z
11
+ date: 2026-04-17 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.9
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 0.3.9
19
+ version: 0.3.11
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.9
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 0.3.9
26
+ version: 0.3.11
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