Skip to content

Commit

Permalink
Copy instance vars in Binding#dup
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Jun 20, 2024
1 parent 97b07e9 commit 1284bf6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/main/java/org/jruby/RubyBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ public IRubyObject initialize(ThreadContext context) {

@JRubyMethod
public IRubyObject dup(ThreadContext context) {
return newBinding(context.runtime, binding.dup(context));
RubyBinding newBinding = newBinding(context.runtime, binding.dup(context));

copyInstanceVariablesInto(newBinding);

return newBinding;
}

@JRubyMethod(name = "initialize_copy", visibility = Visibility.PRIVATE)
Expand Down

0 comments on commit 1284bf6

Please sign in to comment.