@JRubyMethod(name = "initialize", visibility = PRIVATE, rest = true) public IRubyObject initialize(ThreadContext context, IRubyObject[] args) { switch (args.length) { default: // > 1 IRubyObject result = getMetaClass().callMethod(context, "layout", args[1] instanceof RubyArray ? ((RubyArray) args[1]).toJavaArrayUnsafe() : java.util.Arrays.copyOfRange(args, 1, args.length)); if (!(result instanceof StructLayout)) { throw context.runtime.newTypeError("Struct.layout did not return a FFI::StructLayout instance"); } layout = (StructLayout) result; case 1: return initialize(context, args[0]); case 0: return initialize(context); } }
@JRubyMethod(name = "initialize", visibility = PRIVATE, rest = true) public IRubyObject initialize(ThreadContext context, IRubyObject[] args) { switch (args.length) { default: // > 1 IRubyObject result = getMetaClass().callMethod(context, "layout", args[1] instanceof RubyArray ? ((RubyArray) args[1]).toJavaArrayUnsafe() : java.util.Arrays.copyOfRange(args, 1, args.length)); if (!(result instanceof StructLayout)) { throw context.runtime.newTypeError("Struct.layout did not return a FFI::StructLayout instance"); } layout = (StructLayout) result; case 1: return initialize(context, args[0]); case 0: return initialize(context); } }
@JRubyMethod(name = "initialize", visibility = PRIVATE, required = 1, rest = true) public IRubyObject initialize(ThreadContext context, IRubyObject[] args) { if (args.length > 1) { IRubyObject result = getMetaClass().callMethod(context, "layout", args[1] instanceof RubyArray ? ((RubyArray) args[1]).toJavaArrayUnsafe() : java.util.Arrays.copyOfRange(args, 1, args.length)); if (!(result instanceof StructLayout)) { throw context.runtime.newTypeError("Struct.layout did not return a FFI::StructLayout instance"); } layout = (StructLayout) result; } return initialize(context, args[0]); }
@JRubyMethod(name = "initialize", visibility = PRIVATE, required = 1, rest = true) public IRubyObject initialize(ThreadContext context, IRubyObject[] args) { if (args.length > 1) { IRubyObject result = getMetaClass().callMethod(context, "layout", args[1] instanceof RubyArray ? ((RubyArray) args[1]).toJavaArrayUnsafe() : java.util.Arrays.copyOfRange(args, 1, args.length)); if (!(result instanceof StructLayout)) { throw context.runtime.newTypeError("Struct.layout did not return a FFI::StructLayout instance"); } layout = (StructLayout) result; } return initialize(context, args[0]); }
@JRubyMethod(name = "initialize", visibility = PRIVATE) public IRubyObject initialize(ThreadContext context, IRubyObject ptr) { if (!(ptr instanceof AbstractMemory)) { if (ptr.isNil()) { return initialize(context); } throw context.runtime.newTypeError("wrong argument type " + ptr.getMetaClass().getName() + " (expected Pointer or Buffer)"); } if (((AbstractMemory) ptr).getSize() < layout.getSize()) { throw context.runtime.newArgumentError("memory object has insufficient space for " + getMetaClass().getName()); } memory = (AbstractMemory) ptr; setMemoryIO(memory.getMemoryIO()); return this; }
@JRubyMethod(name = "initialize", visibility = PRIVATE) public IRubyObject initialize(ThreadContext context, IRubyObject ptr) { if (!(ptr instanceof AbstractMemory)) { if (ptr.isNil()) { return initialize(context); } throw context.runtime.newTypeError("wrong argument type " + ptr.getMetaClass().getName() + " (expected Pointer or Buffer)"); } if (((AbstractMemory) ptr).getSize() < layout.getSize()) { throw context.runtime.newArgumentError("memory object has insufficient space for " + getMetaClass().getName()); } memory = (AbstractMemory) ptr; setMemoryIO(memory.getMemoryIO()); return this; }
@JRubyMethod(name = "initialize", visibility = PRIVATE) public IRubyObject initialize(ThreadContext context, IRubyObject ptr) { if (!(ptr instanceof AbstractMemory)) { if (ptr.isNil()) { return initialize(context); } throw context.runtime.newTypeError("wrong argument type " + ptr.getMetaClass().getName() + " (expected Pointer or Buffer)"); } if (((AbstractMemory) ptr).getSize() < layout.getSize()) { throw context.runtime.newArgumentError("memory object has insufficient space for " + getMetaClass().getName()); } memory = (AbstractMemory) ptr; setMemoryIO(memory.getMemoryIO()); return this; }
@JRubyMethod(name = "initialize", visibility = PRIVATE) public IRubyObject initialize(ThreadContext context, IRubyObject ptr) { if (!(ptr instanceof AbstractMemory)) { if (ptr.isNil()) { return initialize(context); } throw context.runtime.newTypeError("wrong argument type " + ptr.getMetaClass().getName() + " (expected Pointer or Buffer)"); } if (((AbstractMemory) ptr).getSize() < layout.getSize()) { throw context.runtime.newArgumentError("memory object has insufficient space for " + getMetaClass().getName()); } memory = (AbstractMemory) ptr; setMemoryIO(memory.getMemoryIO()); return this; }