mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Make Struct#keyword_init? return nil by default [Feature #18008]
This commit is contained in:
parent
33bea3bdff
commit
3e7a7fb28a
2 changed files with 8 additions and 10 deletions
15
struct.c
15
struct.c
|
@ -356,19 +356,14 @@ rb_struct_s_inspect(VALUE klass)
|
|||
*
|
||||
* Examples:
|
||||
* Foo = Struct.new(:a)
|
||||
* Foo.keyword_init? # => false
|
||||
* Foo.keyword_init? # => nil
|
||||
* Bar = Struct.new(:a, keyword_init: true)
|
||||
* Bar.keyword_init? # => true
|
||||
* Baz = Struct.new(:a, keyword_init: false)
|
||||
* Baz.keyword_init? # => false
|
||||
*/
|
||||
static VALUE
|
||||
rb_struct_s_keyword_init_p(VALUE klass)
|
||||
{
|
||||
if (RTEST(rb_struct_s_keyword_init(klass))) {
|
||||
return Qtrue;
|
||||
} else {
|
||||
return Qfalse;
|
||||
}
|
||||
}
|
||||
|
||||
#define rb_struct_s_keyword_init_p rb_struct_s_keyword_init
|
||||
|
||||
static VALUE
|
||||
setup_struct(VALUE nstr, VALUE members)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue