MINOR: Remove complicated utility method call from RubyEvent initialize method

Fixes #7825
This commit is contained in:
Armin 2017-07-27 00:09:07 +02:00 committed by Armin Braun
parent 8d216a31c0
commit 1f004c646f

View file

@ -15,7 +15,6 @@ import org.jruby.anno.JRubyMethod;
import org.jruby.exceptions.RaiseException; import org.jruby.exceptions.RaiseException;
import org.jruby.java.proxies.MapJavaProxy; import org.jruby.java.proxies.MapJavaProxy;
import org.jruby.javasupport.JavaUtil; import org.jruby.javasupport.JavaUtil;
import org.jruby.runtime.Arity;
import org.jruby.runtime.ObjectAllocator; import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext; import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject; import org.jruby.runtime.builtin.IRubyObject;
@ -99,8 +98,7 @@ public class JrubyEventExtLibrary implements Library {
// def initialize(data = {}) // def initialize(data = {})
@JRubyMethod(name = "initialize", optional = 1) @JRubyMethod(name = "initialize", optional = 1)
public IRubyObject ruby_initialize(ThreadContext context, IRubyObject[] args) { public IRubyObject ruby_initialize(ThreadContext context, IRubyObject[] args) {
args = Arity.scanArgs(context.runtime, args, 0, 1); final IRubyObject data = args.length > 0 ? args[0] : null;
IRubyObject data = args[0];
if (data instanceof RubyHash) { if (data instanceof RubyHash) {
this.event = new Event(ConvertedMap.newFromRubyHash((RubyHash) data)); this.event = new Event(ConvertedMap.newFromRubyHash((RubyHash) data));
} else { } else {