Skip to content

Commit 4bdec42

Browse files
committed
Avoid extra #to_h call for the common case of Data#to_h without block
1 parent e36724c commit 4bdec42

File tree

1 file changed

+1
-1
lines changed
  • src/main/ruby/truffleruby/core

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def to_h(&block)
121121
Primitive.class(self)::CLASS_MEMBERS.each do |member|
122122
h[member] = Primitive.object_hidden_var_get(self, member)
123123
end
124-
h.to_h(&block)
124+
block ? h.to_h(&block) : h
125125
end
126126
127127
def with(**changes)

0 commit comments

Comments
 (0)