File tree Expand file tree Collapse file tree
core/src/main/java/org/jruby Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -534,8 +534,8 @@ public IRubyObject initialize(ThreadContext context) {
534534 public IRubyObject initialize (ThreadContext context , IRubyObject arg0 ) {
535535 boolean keywords = hasNonemptyKeywords (ThreadContext .resetCallInfo (context ));
536536
537- if (keywords ) {
538- return setupStructValuesFromHash (context , ( RubyHash ) arg0 );
537+ if (keywords && arg0 instanceof RubyHash hash ) {
538+ return setupStructValuesFromHash (context , hash );
539539 } else if (RubyStruct .getInternalVariable (context , classOf (), KEYWORD_INIT_VAR ).isTrue ()) {
540540 if (!(arg0 instanceof RubyHash hash )) throw argumentError (context , 1 , 0 );
541541 return setupStructValuesFromHash (context , hash );
Original file line number Diff line number Diff line change 5959 data . version . should == "3.2"
6060 data . platform . should == "OS"
6161 end
62+
63+ it "can be called via delegated ... from a prepended module" do
64+ wrapper = Module . new do
65+ def initialize ( ...)
66+ super ( ...)
67+ end
68+ end
69+
70+ klass = Class . new ( Struct . new ( :a ) ) { prepend wrapper }
71+ s = klass . new ( "x" )
72+ s . a . should == "x"
73+ end
6274end
You can’t perform that action at this time.
0 commit comments