@@ -471,8 +471,8 @@ rb_struct_define_under(VALUE outer, const char *name, ...)
471
471
*
472
472
* - May be anonymous, or may have the name given by +class_name+.
473
473
* - May have members as given by +member_names+.
474
- * - May have initialization via ordinary arguments (the default)
475
- * or via keyword arguments (if <tt>keyword_init: true</tt> is given).
474
+ * - May have initialization via ordinary arguments (unless
475
+ * <tt>keyword_init: true</tt> is given), or via keyword arguments
476
476
*
477
477
* The new subclass has its own method <tt>::new</tt>; thus:
478
478
*
@@ -557,7 +557,7 @@ rb_struct_define_under(VALUE outer, const char *name, ...)
557
557
* By default, the arguments for initializing an instance of the new subclass
558
558
* are ordinary arguments (not keyword arguments).
559
559
* With optional keyword argument <tt>keyword_init: true</tt>,
560
- * the new subclass is initialized with keyword arguments:
560
+ * the new subclass must be initialized with keyword arguments:
561
561
*
562
562
* # Without keyword_init: true.
563
563
* Foo = Struct.new('Foo', :foo, :bar)
@@ -567,6 +567,7 @@ rb_struct_define_under(VALUE outer, const char *name, ...)
567
567
* Bar = Struct.new(:foo, :bar, keyword_init: true)
568
568
* Bar # => # => Bar(keyword_init: true)
569
569
* Bar.new(bar: 1, foo: 0) # => #<struct Bar foo=0, bar=1>
570
+ * Bar.new(0, 1) # Raises ArgumentError: wrong number of arguments
570
571
*
571
572
*/
572
573
0 commit comments