Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

skeleton of Addrinfo.initialize

  • Loading branch information...
commit a07a9bab44c1b6c8c908dff0db74c697b393d91a 1 parent 3532dff
@BanzaiMan BanzaiMan authored
Showing with 16 additions and 1 deletion.
  1. +16 −1 src/org/jruby/ext/socket/RubyAddrinfo.java
View
17 src/org/jruby/ext/socket/RubyAddrinfo.java
@@ -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;
/**
@@ -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() {
@@ -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");
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.