Skip to content

Commit

Permalink
skeleton of Addrinfo.initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
BanzaiMan committed Jan 29, 2012
1 parent 3532dff commit a07a9ba
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/org/jruby/ext/socket/RubyAddrinfo.java
Expand Up @@ -28,11 +28,14 @@

package org.jruby.ext.socket;

import org.jruby.CompatVersion;
import org.jruby.Ruby;
import org.jruby.RubyClass;
import org.jruby.anno.JRubyClass;
import org.jruby.anno.JRubyMethod;
import org.jruby.cext.RubyData;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

/**
Expand All @@ -43,7 +46,7 @@
public class RubyAddrinfo extends RubyData {
static void createAddrinfo(Ruby runtime) {
RubyClass rb_cAddrinfo = runtime.defineClass("Addrinfo", runtime.getClass("Data"), ADDRINFO_ALLOCATOR);

rb_cAddrinfo.defineAnnotatedMethods(RubyAddrinfo.class);
}

private static ObjectAllocator ADDRINFO_ALLOCATOR = new ObjectAllocator() {
Expand All @@ -56,4 +59,16 @@ public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
public RubyAddrinfo(Ruby runtime, RubyClass klazz) {
super(runtime, klazz);
}

@JRubyMethod(name = "initialize", required = 1, optional = 3, compat = CompatVersion.RUBY1_9)
public IRubyObject initialize(ThreadContext context, IRubyObject[] args) {

checkAddrinfo();
throw context.getRuntime().newNotImplementedError("Not yet implemented");
}

private void checkAddrinfo() {
// TODO: implement this
// throw getRuntime().newTypeError("already initialized socket address");
}
}

0 comments on commit a07a9ba

Please sign in to comment.