Skip to content

Commit ee1e129

Browse files
committed
Rewrite Struct comment so it isn't user-hostile
1 parent 4f02f20 commit ee1e129

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/main/ruby/truffleruby/core/struct.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -402,20 +402,21 @@ def values_at(*args)
402402
# are methods to read them
403403

404404
def self._specialize(attrs)
405-
# Because people are crazy, they subclass Struct directly, ie.
406-
# class Craptastic < Struct
405+
# People want to subclass Struct directly, ie.
407406
#
408-
# NOT
407+
# class MyCoolStruct < Struct
409408
#
410-
# class Fine < Struct.new(:x, :y)
409+
# rather than
411410
#
412-
# When they do this craptastic act, they'll sometimes define their
413-
# own #initialize and super into Struct#initialize.
411+
# class MyCoolStruct < Struct.new(:x, :y)
414412
#
415-
# When they do this and then do Craptastic.new(:x, :y), this code
413+
# They sometimes then define their own #initialize and super into
414+
# Struct#initialize.
415+
#
416+
# When they do this and then do MyCoolStruct.new(:x, :y), this code
416417
# will accidentally shadow their #initialize. So for now, only run
417418
# the specialize if we're trying new Struct's directly from Struct itself,
418-
# not a craptastic Struct subclass.
419+
# not a Struct subclass.
419420

420421
return unless superclass.equal? Struct
421422

0 commit comments

Comments
 (0)