Skip to content

Commit 76375a7

Browse files
Implement no args Struct.new constructor in Ruby 3.3
1 parent c062749 commit 76375a7

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

spec/truffleruby.next-specs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# Use spec/ruby/core/nil/nil_spec.rb as a dummy file to avoid being empty (what causes mspec to error)
1010
spec/ruby/core/nil/nil_spec.rb
1111

12+
spec/ruby/core/struct/new_spec.rb
1213
spec/ruby/core/warning/element_reference_spec.rb
1314
spec/ruby/core/warning/element_set_spec.rb
1415

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class << self
3333
alias_method :subclass_new, :new
3434
end
3535

36-
def self.new(klass_name, *attrs, keyword_init: nil, &block)
36+
def self.new(klass_name = nil, *attrs, keyword_init: nil, &block)
3737
if klass_name
3838
if Primitive.is_a?(klass_name, Symbol) # Truffle: added to avoid exception and match MRI
3939
attrs.unshift klass_name

0 commit comments

Comments
 (0)