package org.msgpack.jruby;


import java.io.IOException;

import org.jruby.Ruby;
import org.jruby.RubyModule;
import org.jruby.RubyClass;
import org.jruby.RubyString;
import org.jruby.RubyHash;
import org.jruby.runtime.load.Library;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.ThreadContext;
import org.jruby.anno.JRubyModule;
import org.jruby.anno.JRubyMethod;


public class MessagePackLibrary implements Library {
  public void load(Ruby runtime, boolean wrap) throws IOException {
    RubyModule msgpackModule = runtime.defineModule("MessagePack");
    msgpackModule.defineAnnotatedMethods(MessagePackModule.class);
  }

  @JRubyModule(name = "MessagePack")
  public static class MessagePackModule {
    @JRubyMethod(module = true, required = 1, optional = 1, alias = {"dump"})
    public static IRubyObject pack(ThreadContext ctx, IRubyObject recv, IRubyObject[] args) throws IOException {
      Encoder encoder = new Encoder(ctx.getRuntime());
      return encoder.encode(args[0]);
    }

    @JRubyMethod(module = true, required = 1, optional = 1, alias = {"load"})
    public static IRubyObject unpack(ThreadContext ctx, IRubyObject recv, IRubyObject[] args) throws IOException {
      Decoder decoder = new Decoder(ctx.getRuntime(), args[0].asString().getBytes());
      return decoder.next();
    }
  }
}

@@ -26,37 +26,8 @@
 ;%0A%0A%0A
-import java.io.IOException;%0A%0A
 impo
@@ -45,16 +45,16 @@
 y.Ruby;%0A
+
 import o
@@ -454,35 +454,16 @@
 an wrap)
- throws IOException
  %7B%0A    R
@@ -845,35 +845,16 @@
 %5B%5D args)
- throws IOException
  %7B%0A     
@@ -1022,24 +1022,24 @@
 = %7B%22load%22%7D)%0A
+
     public s
@@ -1123,27 +1123,8 @@
 rgs)
- throws IOException
  %7B%0A 

Remove IOException from MessagePack signatures