Skip to content

Commit a0e4f1f

Browse files
authored
Fix Set examples for 4.0 (#69)
* 4.0: Fix typo in class name for Set example * 4.0: Inherit from correct Set classes in Set examples The first change is necessary for the example to work at all. The lower two changes are not strictly necessary though, but they may help when trying or copying parts of the example.
1 parent de711bb commit a0e4f1f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

4.0.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ description: Ruby 4.0 full and annotated changelog
88
# Ruby 4.0
99

1010
* **Released at:** Dec 25, 2025 (<a class="github" href="https://github.com/ruby/ruby/blob/v4.0.0/NEWS.md">NEWS.md</a> file)
11-
* **Status (as of Dec 26, 2025):** 4.0 is just released
11+
* **Status (as of Jan 09, 2026):** 4.0 is just released
1212
* **This document first published:** Dec 26, 2025
13-
* **Last change to this document:** Dec 26, 2025
13+
* **Last change to this document:** Jan 09, 2026
1414

1515
<!--
1616
* **Reason:**
@@ -339,7 +339,7 @@ By redefinining `#instance_variables_to_inspect`, the default output of `#inspec
339339

340340
# Now, as methods of SubclassCompatible are implemented mostly as they were before,
341341
# old assumptions work:
342-
class SmallStringSet
342+
class SmallStringSet < Set
343343
def initialize(items) = super(items.to_a[...5])
344344
def add(item) = super(item.to_s)
345345
end
@@ -352,7 +352,7 @@ By redefinining `#instance_variables_to_inspect`, the default output of `#inspec
352352
# Note that if your code relied on `@hash` instance variable directly
353353
# (which it shouldn't have), it will be broken despite the compatibility
354354
# layer:
355-
class SmallStringsSet
355+
class SmallStringSet < Set
356356
# Somebody decided using internal variable would be more efficient
357357
def numeric? = @hash.keys.all?(Numeric)
358358
end
@@ -371,7 +371,7 @@ By redefinining `#instance_variables_to_inspect`, the default output of `#inspec
371371

372372
# It would be faster, but the assumptions which methods calls which
373373
# internally aren't necessary correct anymore
374-
class SmallStringSet2
374+
class SmallStringSet2 < Set::CoreSet
375375
def initialize(items) = super(items.to_a[...5])
376376
def add(item) = super(item.to_s)
377377
end

_src/4.0.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ By redefinining `#instance_variables_to_inspect`, the default output of `#inspec
339339

340340
# Now, as methods of SubclassCompatible are implemented mostly as they were before,
341341
# old assumptions work:
342-
class SmallStringSet
342+
class SmallStringSet < Set
343343
def initialize(items) = super(items.to_a[...5])
344344
def add(item) = super(item.to_s)
345345
end
@@ -352,7 +352,7 @@ By redefinining `#instance_variables_to_inspect`, the default output of `#inspec
352352
# Note that if your code relied on `@hash` instance variable directly
353353
# (which it shouldn't have), it will be broken despite the compatibility
354354
# layer:
355-
class SmallStringsSet
355+
class SmallStringSet < Set
356356
# Somebody decided using internal variable would be more efficient
357357
def numeric? = @hash.keys.all?(Numeric)
358358
end
@@ -371,7 +371,7 @@ By redefinining `#instance_variables_to_inspect`, the default output of `#inspec
371371

372372
# It would be faster, but the assumptions which methods calls which
373373
# internally aren't necessary correct anymore
374-
class SmallStringSet2
374+
class SmallStringSet2 < Set::CoreSet
375375
def initialize(items) = super(items.to_a[...5])
376376
def add(item) = super(item.to_s)
377377
end

0 commit comments

Comments
 (0)