40 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 97d4d8f45b mruby-set: standardize block parameter spacing
changed block spacing from { | to {| for consistency.

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-11 18:09:10 +09:00
Yukihiro "Matz" Matsumoto 29644b0365 mruby-set: add parentheses to to_enum calls
added parentheses to all to_enum calls where the return value is used.

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-11 18:09:07 +09:00
Yukihiro "Matz" Matsumoto 479711700e mruby-set: add comprehensive call-seq documentation for all Ruby methods
Added complete call-seq documentation for all 17 Ruby methods in mrblib/set.rb:

- initialize: Added examples showing set creation with and without blocks
- merge: Added examples showing element merging and self-modification
- replace: Added examples showing complete set replacement
- subtract: Added examples showing element removal from enumerable
- intersection (&): Added examples showing common elements between sets
- union (|, +): Added examples showing set combination operations
- difference (-): Added examples showing set subtraction operations
- ^ (exclusive or): Added examples showing symmetric difference
- each: Added examples showing iteration with blocks and enumerators
- delete_if: Added examples showing conditional element deletion
- keep_if: Added examples showing conditional element retention
- collect!/map!: Added examples showing in-place element transformation
- reject!: Added examples showing conditional deletion with nil return
- select!/filter!: Added examples showing conditional retention with nil return
- classify: Added examples showing element classification into hash
- divide: Added examples showing set division into subsets

Co-authored-by: Atlassian Rovo Dev
2025-07-17 14:46:41 +09:00
Yukihiro "Matz" Matsumoto 2008d1733b mruby-set: use || operator in merge and subtract methods 2025-06-27 09:01:19 +09:00
Yukihiro "Matz" Matsumoto 62affa290f mruby-set: simplify initialize method return flow 2025-06-27 09:01:19 +09:00
Yukihiro "Matz" Matsumoto 6db72e01fe mruby-set: simplify optimized method pattern with || operator 2025-06-27 09:01:19 +09:00
Yukihiro "Matz" Matsumoto 192880c1e7 mruby-set: refactor internal methods for cleaner enumerable logic
Internal C functions now return a status, allowing Ruby methods
to avoid `is_a?(Set)` checks and simplify the logic for handling
different enumerable types.

Co-authored-by: Gemini <gemini@google.com>
2025-06-27 09:01:19 +09:00
Yukihiro "Matz" Matsumoto f47609574a mruby-set: remove some AI generated work-log comments 2025-06-23 17:07:30 +09:00
Yukihiro "Matz" Matsumoto ea0ceff7fb mruby-set: implement Set#flatten and flatten! in C
The code is generated by Cursor.
2025-06-23 17:07:30 +09:00
Yukihiro "Matz" Matsumoto deb5c47fc6 mruby-set: implement comparison methods in C for better performance
Reimplemented the following methods in C for improved efficiency:
- superset? and proper_superset? (>= and >)
- subset? and proper_subset? (<= and <)
- intersect? and disjoint?
- <=> comparison operator
2025-06-23 17:07:27 +09:00
Yukihiro "Matz" Matsumoto 60f06e7a0f mruby-set: Add comprehensive method documentation 2025-06-23 17:07:27 +09:00
Yukihiro "Matz" Matsumoto 091e48159a mruby-set: Use numbered parameters for block arguments 2025-06-23 17:07:27 +09:00
Yukihiro "Matz" Matsumoto 04b38c2c47 mruby-set: rename internal methods
Renaming all internal C methods from __set_* to a cleaner __* convention
(e.g., __set_merge is now __merge), and updating their call sites in the
Ruby code accordingly.
2025-06-23 17:07:26 +09:00
Yukihiro "Matz" Matsumoto e096eeed1a mruby-set: reimplement #initialize in Ruby again
And we have eliminated mrb_funcall* from set.c.
2025-06-23 17:07:26 +09:00
Yukihiro "Matz" Matsumoto 5e2a7568e2 mruby-set: move #replace to Ruby again
Since it does only clear() and merge(), there is little use of the C
implemented fast path. This change also reduce memory consumption.
2025-06-23 17:07:26 +09:00
Yukihiro "Matz" Matsumoto c117674cfe mruby-set: refactor Set#replace
The code is written by Atlassian Rovodev.
2025-06-23 17:07:25 +09:00
Yukihiro "Matz" Matsumoto 8538c79f3f mruby-set: refactor Set#merge
The code is written by Atlassian Rovodev.
2025-06-23 17:07:25 +09:00
Yukihiro "Matz" Matsumoto 169654ad9b mruby-set: refactor Set#subtract
The code is written by Atlassian Rovodev.
2025-06-23 17:07:25 +09:00
Yukihiro "Matz" Matsumoto c188b9a1aa mruby-set: refactor Set#difference
The code is written by Atlassian Rovodev.
2025-06-23 17:07:25 +09:00
Yukihiro "Matz" Matsumoto 10ea05d3aa mruby-set: refactor Set#union (+, |)
The code is written by Atlassian Rovodev.
2025-06-23 17:07:24 +09:00
Yukihiro "Matz" Matsumoto d9f0c5a3a4 mruby-set: refactor Set#xor (^)
According to the similar strategy as Set#intersection.
The code is mostly written by Atlassian Rovodev.
2025-06-23 17:07:24 +09:00
Yukihiro "Matz" Matsumoto 56a41b844e mruby-set: refactor Set#intersection
Define generic operation method in Ruby, then prepare fast-path function
in C as a general structure. Some methods will follow this pattern.
The code is generated by Atlassian Rovodev.
2025-06-23 17:07:24 +09:00
Yukihiro "Matz" Matsumoto abae5a5ff5 mruby-set: remove __equal_fallback that no longer used 2025-06-23 17:07:23 +09:00
Yukihiro "Matz" Matsumoto 52285161e7 mruby-set: remove methods added by AI hallucination 2025-06-23 17:07:22 +09:00
Yukihiro "Matz" Matsumoto 1238fb2808 mruby-set (flatten_merge): remove unnecessary assignment 2025-06-23 17:07:22 +09:00
Yukihiro "Matz" Matsumoto 11106525c4 mruby-set (__get_hash): remove no longer used method 2025-06-23 17:07:22 +09:00
Yukihiro "Matz" Matsumoto 7ffe6a3a9a mruby-set: re-implement Set class in C
The code is mostly developed by Atlassian Rovodev.
2025-06-23 17:07:21 +09:00
Yukihiro "Matz" Matsumoto 10c40c4e87 mruby-set: make Set#initialize_copy private 2025-06-16 12:41:54 +09:00
John Bampton a83d7d3510 Fix indentation in two Ruby files 2023-10-14 18:52:30 +10:00
Yukihiro "Matz" Matsumoto 0713f2a840 mruby-set/set.rb (inspect): add recursive inspect check to Set#inspect 2023-06-20 11:25:49 +09:00
Yukihiro "Matz" Matsumoto ba3541bbc4 mruby-set/set.rb (reset): add reset method defined in Ruby 2.5 2022-12-14 07:38:38 +09:00
Yukihiro "Matz" Matsumoto fe5191398a mruby-set: rename mrb_set.rb to set.rb. 2022-10-25 16:59:49 +09:00
Yukihiro "Matz" Matsumoto e3f74074ba mruby-set: remove intialize_{dup,clone}. 2022-10-25 16:58:31 +09:00
Yukihiro "Matz" Matsumoto 1152c43039 mruby-set: remove taint/untaint which are no longer exist. 2022-10-25 16:57:24 +09:00
Yukihiro "Matz" Matsumoto 7cf3b57cba mruby-set/mrb_set.rb (<=>): update definition.
Set#<=> needs to be comparing sets to be subset/superset relation.
2022-10-24 07:53:52 +09:00
Yukihiro "Matz" Matsumoto 7acf756b6f mruby-set/mrb_set.rb: add __ prefix to internal methods. 2022-10-24 07:44:21 +09:00
Yukihiro "Matz" Matsumoto e9ee0f2953 mruby-set/set.rb (_hash): add utility function to access internal hash.
Since `instance_variable_get` is no longer in the core.
2022-10-24 07:42:52 +09:00
Yukihiro "Matz" Matsumoto d5e13a7f2a mruby-set/set.rb (do_with_enum): prefix _ to internal method. 2022-10-24 07:41:30 +09:00
fn ⌃ ⌥ b0a494c414 mrb_set.rb: improve ruby/spec compliance.
- Alias `#===` to `#include?`
- Alias `#filter!` to `#select!`
- Fix `#subset?` and `#proper_subset?` for Set-like objects.
- Fix `#==`
- Fix `#inspect` for self-referencing sets.
- Add `#<=>` and `#join`
2022-10-23 07:42:25 -07:00
Yukihiro "Matz" Matsumoto 4c86a7a5c3 Add 'mrbgems/mruby-set/' from commit '68334311ac7386eef84f3034a256e7135a87625d'
git-subtree-dir: mrbgems/mruby-set
git-subtree-mainline: 3b55a09f91
git-subtree-split: 68334311ac
2022-10-21 13:56:07 +09:00