Skip to content

Commit ab29875

Browse files
transclaude
andcommitted
Remove core methods now provided by Ruby
Triage Facets core library against Ruby 3.4 built-ins. Remove methods that Ruby has adopted (many originally from Facets), and fix clashes where Facets had different semantics than Ruby's version. Removed (adopted by Ruby): - Numeric#positive?, #negative? (2.3) - Object#itself (2.6) - Enumerable#sum (2.4) - Symbol#succ (1.9) - File.write (1.9) - Process.daemon (1.9) - Dir#each_child (2.6) - Kernel#__DIR__ (2.0), #instance_exec (1.9), #singleton_class (1.9) - Kernel#p override (1.9) - Method#curry (2.2) - Class#singleton_class? (3.2), #subclasses (3.1) - MatchData#match (3.1) - Range#overlap? (3.3) - Array#to_h (2.1) - Hash#except (3.0), Hash#slice (2.5) — bang versions retained Removed (clashes with different Ruby semantics): - Array#intersection (clashes with Ruby 2.7 Array#intersection) - String#crypt override (Ruby deprecated crypt in 3.2) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent adb558a commit ab29875

38 files changed

Lines changed: 26 additions & 714 deletions

HISTORY.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,32 @@ Changes:
3737
`collection.each_with_object([]) { |el, out| out << el if cond }`.
3838
* Remove Ruby 1.8 compatibility code from `enumerator.rb`.
3939
* Remove `taint`/`tainted?` references (removed from Ruby in 3.2).
40+
* Remove `Enumerable#sum` (adopted by Ruby in 2.4).
41+
For non-numeric cases (e.g. `[[1],[2],[3]]`), use `reduce(:+)` instead.
42+
* Remove `String#crypt` override (Ruby deprecated `crypt` in 3.2; use `bcrypt` gem instead).
43+
* Remove `MatchData#match` (adopted by Ruby in 3.1).
44+
* Remove `Range#overlap?` (adopted by Ruby in 3.3).
45+
* Remove `Kernel#__DIR__` (adopted by Ruby as `__dir__` in 2.0).
46+
* Remove `Kernel#instance_exec` (adopted by Ruby in 1.9).
47+
* Remove `Kernel#singleton_class` (adopted by Ruby in 1.9).
48+
* Remove `Kernel#p` override (Ruby's `p` returns its arguments since 1.9).
49+
* Remove `Method#curry` (adopted by Ruby in 2.2).
50+
* Remove `Array#to_h` (adopted by Ruby in 2.1).
51+
* Remove `Array#intersection` (clashes with Ruby 2.7's `Array#intersection`).
52+
Consider `Range.intersection` class method as future replacement.
53+
* Remove `Hash#except` (adopted by Ruby in 3.0); `except!` and `remove!` retained.
54+
* Remove `Hash#slice` (adopted by Ruby in 2.5); `slice!` retained.
55+
Block form removed from both; use `slice(...).select { ... }` instead.
56+
* Remove `Class#singleton_class?` (adopted by Ruby in 3.2).
57+
* Remove `Class#subclasses` (adopted by Ruby in 3.1).
58+
* Remove `Symbol#succ` (adopted by Ruby in 1.9).
59+
* Remove `File.write` (adopted by Ruby in 1.9).
60+
* Remove `Process.daemon` (adopted by Ruby in 1.9).
61+
* Remove `Dir#each_child` (adopted by Ruby in 2.6).
62+
Note: Ruby's version does not support the custom ignore argument.
63+
Use `Dir.each_child('/path').reject { |f| ignore.include?(f) }` instead.
64+
* Remove `Numeric#positive?` and `Numeric#negative?` (adopted by Ruby in 2.3).
65+
* Remove `Object#itself` (adopted by Ruby in 2.6).
4066
* Drop unused `test_files` directive from gemspec. (PR#301)
4167

4268

demo/core/array/intersection.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

demo/core/array/to_h.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

demo/core/matchdata/match.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

demo/core/string/crypt.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/core/facets/array/intersection.rb

Lines changed: 0 additions & 25 deletions
This file was deleted.

lib/core/facets/array/to_h.rb

Lines changed: 0 additions & 19 deletions
This file was deleted.

lib/core/facets/class/singleton_class.rb

Lines changed: 0 additions & 16 deletions
This file was deleted.

lib/core/facets/class/subclasses.rb

Lines changed: 0 additions & 26 deletions
This file was deleted.

lib/core/facets/dir/each_child.rb

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)