diff --git a/README.md b/README.md index 3103266a0..c65a139c5 100644 --- a/README.md +++ b/README.md @@ -2301,11 +2301,20 @@ condition](#safe-assignment-in-condition). ```` * - Don't extend a `Struct.new` - it already is a new class. Extending it - introduces a superfluous class level and may also introduce weird errors if - the file is required multiple times. + Don't extend an instance initialized by `Struct.new`. Extending it introduces + a superfluous class level and may also introduce weird errors if the file is + required multiple times. [[link](#no-extend-struct-new)] + ```Ruby + # bad + class Person < Struct.new(:first_name, :last_name) + end + + # good + Person = Struct.new(:first_name, :last_name) + ```` + * Consider adding factory methods to provide additional sensible ways to create instances of a particular class.