Hello community,

here is the log from the commit of package rubygem-msgpack for openSUSE:Factory 
checked in at 2017-03-09 02:01:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-msgpack (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-msgpack.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-msgpack"

Thu Mar  9 02:01:24 2017 rev:2 rq:460831 version:1.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-msgpack/rubygem-msgpack.changes  
2017-02-21 13:38:31.512374593 +0100
+++ /work/SRC/openSUSE:Factory/.rubygem-msgpack.new/rubygem-msgpack.changes     
2017-03-09 02:01:25.539961941 +0100
@@ -1,0 +2,10 @@
+Tue Feb 28 05:42:22 UTC 2017 - [email protected]
+
+- updated to version 1.1.0
+ see installed ChangeLog
+
+  2017-02-28 version 1.1.0:
+  
+  * Fix the extention type handling to accept modules in addition to classes
+
+-------------------------------------------------------------------

Old:
----
  msgpack-1.0.3.gem

New:
----
  msgpack-1.1.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-msgpack.spec ++++++
--- /var/tmp/diff_new_pack.ATkA1d/_old  2017-03-09 02:01:26.411838393 +0100
+++ /var/tmp/diff_new_pack.ATkA1d/_new  2017-03-09 02:01:26.411838393 +0100
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-msgpack
-Version:        1.0.3
+Version:        1.1.0
 Release:        0
 %define mod_name msgpack
 %define mod_full_name %{mod_name}-%{version}

++++++ msgpack-1.0.3.gem -> msgpack-1.1.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ChangeLog new/ChangeLog
--- old/ChangeLog       2017-01-25 07:00:26.000000000 +0100
+++ new/ChangeLog       2017-02-28 05:17:49.000000000 +0100
@@ -1,3 +1,7 @@
+2017-02-28 version 1.1.0:
+
+* Fix the extention type handling to accept modules in addition to classes
+
 2017-01-24 version 1.0.3:
 
 * Support Ruby 2.4
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/java/org/msgpack/jruby/Encoder.java 
new/ext/java/org/msgpack/jruby/Encoder.java
--- old/ext/java/org/msgpack/jruby/Encoder.java 2017-01-25 07:00:26.000000000 
+0100
+++ new/ext/java/org/msgpack/jruby/Encoder.java 2017-02-28 05:17:49.000000000 
+0100
@@ -7,6 +7,7 @@
 
 import org.jruby.Ruby;
 import org.jruby.RubyObject;
+import org.jruby.RubyModule;
 import org.jruby.RubyNil;
 import org.jruby.RubyBoolean;
 import org.jruby.RubyNumeric;
@@ -375,7 +376,15 @@
 
   private void appendOther(IRubyObject object, IRubyObject destination) {
     if (registry != null) {
-      IRubyObject[] pair = registry.lookupPackerByClass(object.getType());
+      RubyModule lookupClass;
+
+      if (object.getType() == runtime.getSymbol()) {
+        lookupClass = object.getType();
+      } else {
+        lookupClass = object.getSingletonClass();
+      }
+
+      IRubyObject[] pair = registry.lookupPackerByModule(lookupClass);
       if (pair != null) {
         RubyString bytes = pair[0].callMethod(runtime.getCurrentContext(), 
"call", object).asString();
         int type = (int) ((RubyFixnum) pair[1]).getLongValue();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/java/org/msgpack/jruby/ExtensionRegistry.java 
new/ext/java/org/msgpack/jruby/ExtensionRegistry.java
--- old/ext/java/org/msgpack/jruby/ExtensionRegistry.java       2017-01-25 
07:00:26.000000000 +0100
+++ new/ext/java/org/msgpack/jruby/ExtensionRegistry.java       2017-02-28 
05:17:49.000000000 +0100
@@ -3,7 +3,7 @@
 import org.jruby.Ruby;
 import org.jruby.RubyHash;
 import org.jruby.RubyArray;
-import org.jruby.RubyClass;
+import org.jruby.RubyModule;
 import org.jruby.RubyFixnum;
 import org.jruby.runtime.ThreadContext;
 import org.jruby.runtime.builtin.IRubyObject;
@@ -12,19 +12,19 @@
 import java.util.HashMap;
 
 public class ExtensionRegistry {
-  private final Map<RubyClass, ExtensionEntry> extensionsByClass;
-  private final Map<RubyClass, ExtensionEntry> extensionsByAncestor;
+  private final Map<RubyModule, ExtensionEntry> extensionsByModule;
+  private final Map<RubyModule, ExtensionEntry> extensionsByAncestor;
   private final ExtensionEntry[] extensionsByTypeId;
 
   public ExtensionRegistry() {
-    this(new HashMap<RubyClass, ExtensionEntry>());
+    this(new HashMap<RubyModule, ExtensionEntry>());
   }
 
-  private ExtensionRegistry(Map<RubyClass, ExtensionEntry> extensionsByClass) {
-    this.extensionsByClass = new HashMap<RubyClass, 
ExtensionEntry>(extensionsByClass);
-    this.extensionsByAncestor = new HashMap<RubyClass, ExtensionEntry>();
+  private ExtensionRegistry(Map<RubyModule, ExtensionEntry> 
extensionsByModule) {
+    this.extensionsByModule = new HashMap<RubyModule, 
ExtensionEntry>(extensionsByModule);
+    this.extensionsByAncestor = new HashMap<RubyModule, ExtensionEntry>();
     this.extensionsByTypeId = new ExtensionEntry[256];
-    for (ExtensionEntry entry : extensionsByClass.values()) {
+    for (ExtensionEntry entry : extensionsByModule.values()) {
       if (entry.hasUnpacker()) {
         extensionsByTypeId[entry.getTypeId() + 128] = entry;
       }
@@ -32,15 +32,15 @@
   }
 
   public ExtensionRegistry dup() {
-    return new ExtensionRegistry(extensionsByClass);
+    return new ExtensionRegistry(extensionsByModule);
   }
 
   public IRubyObject toInternalPackerRegistry(ThreadContext ctx) {
     RubyHash hash = RubyHash.newHash(ctx.getRuntime());
-    for (RubyClass extensionClass : extensionsByClass.keySet()) {
-      ExtensionEntry entry = extensionsByClass.get(extensionClass);
+    for (RubyModule extensionModule : extensionsByModule.keySet()) {
+      ExtensionEntry entry = extensionsByModule.get(extensionModule);
       if (entry.hasPacker()) {
-        hash.put(extensionClass, entry.toPackerTuple(ctx));
+        hash.put(extensionModule, entry.toPackerTuple(ctx));
       }
     }
     return hash;
@@ -58,9 +58,9 @@
     return hash;
   }
 
-  public void put(RubyClass cls, int typeId, IRubyObject packerProc, 
IRubyObject packerArg, IRubyObject unpackerProc, IRubyObject unpackerArg) {
-    ExtensionEntry entry = new ExtensionEntry(cls, typeId, packerProc, 
packerArg, unpackerProc, unpackerArg);
-    extensionsByClass.put(cls, entry);
+  public void put(RubyModule mod, int typeId, IRubyObject packerProc, 
IRubyObject packerArg, IRubyObject unpackerProc, IRubyObject unpackerArg) {
+    ExtensionEntry entry = new ExtensionEntry(mod, typeId, packerProc, 
packerArg, unpackerProc, unpackerArg);
+    extensionsByModule.put(mod, entry);
     extensionsByTypeId[typeId + 128] = entry;
     extensionsByAncestor.clear();
   }
@@ -74,45 +74,45 @@
     }
   }
 
-  public IRubyObject[] lookupPackerByClass(RubyClass cls) {
-    ExtensionEntry e = extensionsByClass.get(cls);
+  public IRubyObject[] lookupPackerByModule(RubyModule mod) {
+    ExtensionEntry e = extensionsByModule.get(mod);
     if (e == null) {
-      e = extensionsByAncestor.get(cls);
+      e = extensionsByAncestor.get(mod);
     }
     if (e == null) {
-      e = findEntryByClassOrAncestor(cls);
+      e = findEntryByModuleOrAncestor(mod);
       if (e != null) {
-        extensionsByAncestor.put(e.getExtensionClass(), e);
+        extensionsByAncestor.put(e.getExtensionModule(), e);
       }
     }
     if (e != null && e.hasPacker()) {
-      return e.toPackerProcTypeIdPair(cls.getRuntime().getCurrentContext());
+      return e.toPackerProcTypeIdPair(mod.getRuntime().getCurrentContext());
     } else {
       return null;
     }
   }
 
-  private ExtensionEntry findEntryByClassOrAncestor(final RubyClass cls) {
-    ThreadContext ctx = cls.getRuntime().getCurrentContext();
-    for (RubyClass extensionClass : extensionsByClass.keySet()) {
-      RubyArray ancestors = (RubyArray) cls.callMethod(ctx, "ancestors");
-      if (ancestors.callMethod(ctx, "include?", extensionClass).isTrue()) {
-        return extensionsByClass.get(extensionClass);
+  private ExtensionEntry findEntryByModuleOrAncestor(final RubyModule mod) {
+    ThreadContext ctx = mod.getRuntime().getCurrentContext();
+    for (RubyModule extensionModule : extensionsByModule.keySet()) {
+      RubyArray ancestors = (RubyArray) mod.callMethod(ctx, "ancestors");
+      if (ancestors.callMethod(ctx, "include?", extensionModule).isTrue()) {
+        return extensionsByModule.get(extensionModule);
       }
     }
     return null;
   }
 
   private static class ExtensionEntry {
-    private final RubyClass cls;
+    private final RubyModule mod;
     private final int typeId;
     private final IRubyObject packerProc;
     private final IRubyObject packerArg;
     private final IRubyObject unpackerProc;
     private final IRubyObject unpackerArg;
 
-    public ExtensionEntry(RubyClass cls, int typeId, IRubyObject packerProc, 
IRubyObject packerArg, IRubyObject unpackerProc, IRubyObject unpackerArg) {
-      this.cls = cls;
+    public ExtensionEntry(RubyModule mod, int typeId, IRubyObject packerProc, 
IRubyObject packerArg, IRubyObject unpackerProc, IRubyObject unpackerArg) {
+      this.mod = mod;
       this.typeId = typeId;
       this.packerProc = packerProc;
       this.packerArg = packerArg;
@@ -120,8 +120,8 @@
       this.unpackerArg = unpackerArg;
     }
 
-    public RubyClass getExtensionClass() {
-      return cls;
+    public RubyModule getExtensionModule() {
+      return mod;
     }
 
     public int getTypeId() {
@@ -149,7 +149,7 @@
     }
 
     public RubyArray toUnpackerTuple(ThreadContext ctx) {
-      return RubyArray.newArray(ctx.getRuntime(), new IRubyObject[] {cls, 
unpackerProc, unpackerArg});
+      return RubyArray.newArray(ctx.getRuntime(), new IRubyObject[] {mod, 
unpackerProc, unpackerArg});
     }
 
     public IRubyObject[] toPackerProcTypeIdPair(ThreadContext ctx) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/java/org/msgpack/jruby/Factory.java 
new/ext/java/org/msgpack/jruby/Factory.java
--- old/ext/java/org/msgpack/jruby/Factory.java 2017-01-25 07:00:26.000000000 
+0100
+++ new/ext/java/org/msgpack/jruby/Factory.java 2017-02-28 05:17:49.000000000 
+0100
@@ -2,6 +2,7 @@
 
 
 import org.jruby.Ruby;
+import org.jruby.RubyModule;
 import org.jruby.RubyClass;
 import org.jruby.RubyObject;
 import org.jruby.RubyArray;
@@ -70,7 +71,7 @@
   public IRubyObject registerType(ThreadContext ctx, IRubyObject[] args) {
     Ruby runtime = ctx.getRuntime();
     IRubyObject type = args[0];
-    IRubyObject klass = args[1];
+    IRubyObject mod = args[1];
 
     IRubyObject packerArg;
     IRubyObject unpackerArg;
@@ -94,10 +95,10 @@
       throw runtime.newRangeError(String.format("integer %d too big to convert 
to `signed char'", typeId));
     }
 
-    if (!(klass instanceof RubyClass)) {
-      throw runtime.newArgumentError(String.format("expected Class but found 
%s.", klass.getType().getName()));
+    if (!(mod instanceof RubyModule)) {
+      throw runtime.newArgumentError(String.format("expected Module/Class but 
found %s.", mod.getType().getName()));
     }
-    RubyClass extClass = (RubyClass) klass;
+    RubyModule extModule = (RubyModule) mod;
 
     IRubyObject packerProc = runtime.getNil();
     IRubyObject unpackerProc = runtime.getNil();
@@ -106,15 +107,15 @@
     }
     if (unpackerArg != null) {
       if (unpackerArg instanceof RubyString || unpackerArg instanceof 
RubySymbol) {
-        unpackerProc = extClass.method(unpackerArg.callMethod(ctx, "to_sym"));
+        unpackerProc = extModule.method(unpackerArg.callMethod(ctx, "to_sym"));
       } else {
         unpackerProc = unpackerArg.callMethod(ctx, "method", 
runtime.newSymbol("call"));
       }
     }
 
-    extensionRegistry.put(extClass, (int) typeId, packerProc, packerArg, 
unpackerProc, unpackerArg);
+    extensionRegistry.put(extModule, (int) typeId, packerProc, packerArg, 
unpackerProc, unpackerArg);
 
-    if (extClass == runtime.getSymbol()) {
+    if (extModule == runtime.getSymbol()) {
       hasSymbolExtType = true;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/java/org/msgpack/jruby/Packer.java 
new/ext/java/org/msgpack/jruby/Packer.java
--- old/ext/java/org/msgpack/jruby/Packer.java  2017-01-25 07:00:26.000000000 
+0100
+++ new/ext/java/org/msgpack/jruby/Packer.java  2017-02-28 05:17:49.000000000 
+0100
@@ -2,6 +2,7 @@
 
 
 import org.jruby.Ruby;
+import org.jruby.RubyModule;
 import org.jruby.RubyClass;
 import org.jruby.RubyObject;
 import org.jruby.RubyArray;
@@ -78,7 +79,7 @@
   public IRubyObject registerType(ThreadContext ctx, IRubyObject[] args, final 
Block block) {
     Ruby runtime = ctx.getRuntime();
     IRubyObject type = args[0];
-    IRubyObject klass = args[1];
+    IRubyObject mod = args[1];
 
     IRubyObject arg;
     IRubyObject proc;
@@ -100,14 +101,14 @@
       throw runtime.newRangeError(String.format("integer %d too big to convert 
to `signed char'", typeId));
     }
 
-    if (!(klass instanceof RubyClass)) {
-      throw runtime.newArgumentError(String.format("expected Class but found 
%s.", klass.getType().getName()));
+    if (!(mod instanceof RubyModule)) {
+      throw runtime.newArgumentError(String.format("expected Module/Class but 
found %s.", mod.getType().getName()));
     }
-    RubyClass extClass = (RubyClass) klass;
+    RubyModule extModule = (RubyModule) mod;
 
-    registry.put(extClass, (int) typeId, proc, arg, null, null);
+    registry.put(extModule, (int) typeId, proc, arg, null, null);
 
-    if (extClass == runtime.getSymbol()) {
+    if (extModule == runtime.getSymbol()) {
       encoder.hasSymbolExtType = true;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/java/org/msgpack/jruby/Unpacker.java 
new/ext/java/org/msgpack/jruby/Unpacker.java
--- old/ext/java/org/msgpack/jruby/Unpacker.java        2017-01-25 
07:00:26.000000000 +0100
+++ new/ext/java/org/msgpack/jruby/Unpacker.java        2017-02-28 
05:17:49.000000000 +0100
@@ -3,6 +3,7 @@
 import java.util.Arrays;
 
 import org.jruby.Ruby;
+import org.jruby.RubyModule;
 import org.jruby.RubyClass;
 import org.jruby.RubyString;
 import org.jruby.RubyObject;
@@ -100,7 +101,7 @@
     Ruby runtime = ctx.getRuntime();
     IRubyObject type = args[0];
 
-    RubyClass extClass;
+    RubyModule extModule;
     IRubyObject arg;
     IRubyObject proc;
     if (args.length == 1) {
@@ -111,11 +112,11 @@
       if (proc == null)
         System.err.println("proc from Block is null");
       arg = proc;
-      extClass = null;
+      extModule = null;
     } else if (args.length == 3) {
-      extClass = (RubyClass) args[1];
+      extModule = (RubyModule) args[1];
       arg = args[2];
-      proc = extClass.method(arg);
+      proc = extModule.method(arg);
     } else {
       throw runtime.newArgumentError(String.format("wrong number of arguments 
(%d for 1 or 3)", 2 + args.length));
     }
@@ -125,7 +126,7 @@
       throw runtime.newRangeError(String.format("integer %d too big to convert 
to `signed char'", typeId));
     }
 
-    registry.put(extClass, (int) typeId, null, null, proc, arg);
+    registry.put(extModule, (int) typeId, null, null, proc, arg);
     return runtime.getNil();
   }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/msgpack/factory_class.c 
new/ext/msgpack/factory_class.c
--- old/ext/msgpack/factory_class.c     2017-01-25 07:00:26.000000000 +0100
+++ new/ext/msgpack/factory_class.c     2017-02-28 05:17:49.000000000 +0100
@@ -141,7 +141,7 @@
     FACTORY(self, fc);
 
     int ext_type;
-    VALUE ext_class;
+    VALUE ext_module;
     VALUE options;
     VALUE packer_arg, unpacker_arg;
     VALUE packer_proc, unpacker_proc;
@@ -170,9 +170,9 @@
         rb_raise(rb_eRangeError, "integer %d too big to convert to `signed 
char'", ext_type);
     }
 
-    ext_class = argv[1];
-    if(rb_type(ext_class) != T_CLASS) {
-        rb_raise(rb_eArgError, "expected Class but found %s.", 
rb_obj_classname(ext_class));
+    ext_module = argv[1];
+    if(rb_type(ext_module) != T_MODULE && rb_type(ext_module) != T_CLASS) {
+        rb_raise(rb_eArgError, "expected Module/Class but found %s.", 
rb_obj_classname(ext_module));
     }
 
     packer_proc = Qnil;
@@ -184,19 +184,19 @@
 
     if(unpacker_arg != Qnil) {
         if(rb_type(unpacker_arg) == T_SYMBOL || rb_type(unpacker_arg) == 
T_STRING) {
-            unpacker_proc = rb_obj_method(ext_class, unpacker_arg);
+            unpacker_proc = rb_obj_method(ext_module, unpacker_arg);
         } else {
             unpacker_proc = rb_funcall(unpacker_arg, rb_intern("method"), 1, 
ID2SYM(rb_intern("call")));
         }
     }
 
-    msgpack_packer_ext_registry_put(&fc->pkrg, ext_class, ext_type, 
packer_proc, packer_arg);
+    msgpack_packer_ext_registry_put(&fc->pkrg, ext_module, ext_type, 
packer_proc, packer_arg);
 
-    if (ext_class == rb_cSymbol) {
+    if (ext_module == rb_cSymbol) {
         fc->has_symbol_ext_type = true;
     }
 
-    msgpack_unpacker_ext_registry_put(&fc->ukrg, ext_class, ext_type, 
unpacker_proc, unpacker_arg);
+    msgpack_unpacker_ext_registry_put(&fc->ukrg, ext_module, ext_type, 
unpacker_proc, unpacker_arg);
 
     return Qnil;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/msgpack/packer.c new/ext/msgpack/packer.c
--- old/ext/msgpack/packer.c    2017-01-25 07:00:26.000000000 +0100
+++ new/ext/msgpack/packer.c    2017-02-28 05:17:49.000000000 +0100
@@ -124,8 +124,27 @@
 void msgpack_packer_write_other_value(msgpack_packer_t* pk, VALUE v)
 {
     int ext_type;
-    VALUE proc = msgpack_packer_ext_registry_lookup(&pk->ext_registry,
-            rb_obj_class(v), &ext_type);
+
+    VALUE lookup_class;
+
+    /*
+     * Objects of type Integer (Fixnum, Bignum), Float, Symbol and frozen
+     * String have no singleton class and raise a TypeError when trying to get
+     * it. See implementation of #singleton_class in ruby's source code:
+     * VALUE rb_singleton_class(VALUE obj);
+     *
+     * Since all but symbols are already filtered out when reaching this code
+     * only symbols are checked here.
+     */
+    if (SYMBOL_P(v)) {
+      lookup_class = rb_obj_class(v);
+    } else {
+      lookup_class = rb_singleton_class(v);
+    }
+
+    VALUE proc = msgpack_packer_ext_registry_lookup(&pk->ext_registry, 
lookup_class,
+      &ext_type);
+
     if(proc != Qnil) {
         VALUE payload = rb_funcall(proc, s_call, 1, v);
         StringValue(payload);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/msgpack/packer_class.c 
new/ext/msgpack/packer_class.c
--- old/ext/msgpack/packer_class.c      2017-01-25 07:00:26.000000000 +0100
+++ new/ext/msgpack/packer_class.c      2017-02-28 05:17:49.000000000 +0100
@@ -249,7 +249,7 @@
     PACKER(self, pk);
 
     int ext_type;
-    VALUE ext_class;
+    VALUE ext_module;
     VALUE proc;
     VALUE arg;
 
@@ -279,14 +279,14 @@
         rb_raise(rb_eRangeError, "integer %d too big to convert to `signed 
char'", ext_type);
     }
 
-    ext_class = argv[1];
-    if(rb_type(ext_class) != T_CLASS) {
-        rb_raise(rb_eArgError, "expected Class but found %s.", 
rb_obj_classname(ext_class));
+    ext_module = argv[1];
+    if(rb_type(ext_module) != T_MODULE && rb_type(ext_module) != T_CLASS) {
+        rb_raise(rb_eArgError, "expected Module/Class but found %s.", 
rb_obj_classname(ext_module));
     }
 
-    msgpack_packer_ext_registry_put(&pk->ext_registry, ext_class, ext_type, 
proc, arg);
+    msgpack_packer_ext_registry_put(&pk->ext_registry, ext_module, ext_type, 
proc, arg);
 
-    if (ext_class == rb_cSymbol) {
+    if (ext_module == rb_cSymbol) {
         pk->has_symbol_ext_type = true;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/msgpack/packer_ext_registry.c 
new/ext/msgpack/packer_ext_registry.c
--- old/ext/msgpack/packer_ext_registry.c       2017-01-25 07:00:26.000000000 
+0100
+++ new/ext/msgpack/packer_ext_registry.c       2017-02-28 05:17:49.000000000 
+0100
@@ -64,7 +64,7 @@
 #endif
 
 VALUE msgpack_packer_ext_registry_put(msgpack_packer_ext_registry_t* pkrg,
-        VALUE ext_class, int ext_type, VALUE proc, VALUE arg)
+        VALUE ext_module, int ext_type, VALUE proc, VALUE arg)
 {
     VALUE e = rb_ary_new3(3, INT2FIX(ext_type), proc, arg);
     /* clear lookup cache not to miss added type */
@@ -75,5 +75,5 @@
         rb_hash_foreach(pkrg->cache, __rb_hash_clear_clear_i, 0);
     }
 #endif
-    return rb_hash_aset(pkrg->hash, ext_class, e);
+    return rb_hash_aset(pkrg->hash, ext_module, e);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/msgpack/packer_ext_registry.h 
new/ext/msgpack/packer_ext_registry.h
--- old/ext/msgpack/packer_ext_registry.h       2017-01-25 07:00:26.000000000 
+0100
+++ new/ext/msgpack/packer_ext_registry.h       2017-02-28 05:17:49.000000000 
+0100
@@ -44,7 +44,7 @@
         msgpack_packer_ext_registry_t* dst);
 
 VALUE msgpack_packer_ext_registry_put(msgpack_packer_ext_registry_t* pkrg,
-        VALUE ext_class, int ext_type, VALUE proc, VALUE arg);
+        VALUE ext_module, int ext_type, VALUE proc, VALUE arg);
 
 static int msgpack_packer_ext_find_superclass(VALUE key, VALUE value, VALUE 
arg)
 {
@@ -61,32 +61,32 @@
 
 
 static inline VALUE 
msgpack_packer_ext_registry_lookup(msgpack_packer_ext_registry_t* pkrg,
-        VALUE ext_class, int* ext_type_result)
+        VALUE lookup_class, int* ext_type_result)
 {
-    VALUE type = rb_hash_lookup(pkrg->hash, ext_class);
+    VALUE type = rb_hash_lookup(pkrg->hash, lookup_class);
     if(type != Qnil) {
         *ext_type_result = FIX2INT(rb_ary_entry(type, 0));
         return rb_ary_entry(type, 1);
     }
 
-    VALUE type_inht = rb_hash_lookup(pkrg->cache, ext_class);
+    VALUE type_inht = rb_hash_lookup(pkrg->cache, lookup_class);
     if(type_inht != Qnil) {
         *ext_type_result = FIX2INT(rb_ary_entry(type_inht, 0));
         return rb_ary_entry(type_inht, 1);
     }
 
     /*
-     * check all keys whether it is super class of ext_class, or not
+     * check all keys whether it is an ancestor of lookup_class, or not
      */
     VALUE args[2];
-    args[0] = ext_class;
+    args[0] = lookup_class;
     args[1] = Qnil;
     rb_hash_foreach(pkrg->hash, msgpack_packer_ext_find_superclass, (VALUE) 
args);
 
     VALUE superclass = args[1];
     if(superclass != Qnil) {
         VALUE superclass_type = rb_hash_lookup(pkrg->hash, superclass);
-        rb_hash_aset(pkrg->cache, ext_class, superclass_type);
+        rb_hash_aset(pkrg->cache, lookup_class, superclass_type);
         *ext_type_result = FIX2INT(rb_ary_entry(superclass_type, 0));
         return rb_ary_entry(superclass_type, 1);
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/msgpack/unpacker_class.c 
new/ext/msgpack/unpacker_class.c
--- old/ext/msgpack/unpacker_class.c    2017-01-25 07:00:26.000000000 +0100
+++ new/ext/msgpack/unpacker_class.c    2017-02-28 05:17:49.000000000 +0100
@@ -348,7 +348,7 @@
     int ext_type;
     VALUE proc;
     VALUE arg;
-    VALUE ext_class;
+    VALUE ext_module;
 
     switch (argc) {
     case 1:
@@ -361,13 +361,13 @@
         proc = rb_block_proc();
 #endif
         arg = proc;
-        ext_class = Qnil;
+        ext_module = Qnil;
         break;
     case 3:
         /* register_type(0x7f, Time, :from_msgpack_ext) */
-        ext_class = argv[1];
+        ext_module = argv[1];
         arg = argv[2];
-        proc = rb_obj_method(ext_class, arg);
+        proc = rb_obj_method(ext_module, arg);
         break;
     default:
         rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 3)", 
argc);
@@ -378,7 +378,7 @@
         rb_raise(rb_eRangeError, "integer %d too big to convert to `signed 
char'", ext_type);
     }
 
-    msgpack_unpacker_ext_registry_put(&uk->ext_registry, ext_class, ext_type, 
proc, arg);
+    msgpack_unpacker_ext_registry_put(&uk->ext_registry, ext_module, ext_type, 
proc, arg);
 
     return Qnil;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/msgpack/unpacker_ext_registry.c 
new/ext/msgpack/unpacker_ext_registry.c
--- old/ext/msgpack/unpacker_ext_registry.c     2017-01-25 07:00:26.000000000 
+0100
+++ new/ext/msgpack/unpacker_ext_registry.c     2017-02-28 05:17:49.000000000 
+0100
@@ -53,9 +53,9 @@
 }
 
 VALUE msgpack_unpacker_ext_registry_put(msgpack_unpacker_ext_registry_t* ukrg,
-        VALUE ext_class, int ext_type, VALUE proc, VALUE arg)
+        VALUE ext_module, int ext_type, VALUE proc, VALUE arg)
 {
-    VALUE e = rb_ary_new3(3, ext_class, proc, arg);
+    VALUE e = rb_ary_new3(3, ext_module, proc, arg);
     VALUE before = ukrg->array[ext_type + 128];
     ukrg->array[ext_type + 128] = e;
     return before;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ext/msgpack/unpacker_ext_registry.h 
new/ext/msgpack/unpacker_ext_registry.h
--- old/ext/msgpack/unpacker_ext_registry.h     2017-01-25 07:00:26.000000000 
+0100
+++ new/ext/msgpack/unpacker_ext_registry.h     2017-02-28 05:17:49.000000000 
+0100
@@ -44,7 +44,7 @@
         msgpack_unpacker_ext_registry_t* dst);
 
 VALUE msgpack_unpacker_ext_registry_put(msgpack_unpacker_ext_registry_t* ukrg,
-        VALUE ext_class, int ext_type, VALUE proc, VALUE arg);
+        VALUE ext_module, int ext_type, VALUE proc, VALUE arg);
 
 static inline VALUE 
msgpack_unpacker_ext_registry_lookup(msgpack_unpacker_ext_registry_t* ukrg,
         int ext_type)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/msgpack/version.rb new/lib/msgpack/version.rb
--- old/lib/msgpack/version.rb  2017-01-25 07:00:26.000000000 +0100
+++ new/lib/msgpack/version.rb  2017-02-28 05:17:49.000000000 +0100
@@ -1,3 +1,3 @@
 module MessagePack
-  VERSION = "1.0.3"
+  VERSION = "1.1.0"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2017-01-25 07:00:26.000000000 +0100
+++ new/metadata        2017-02-28 05:17:49.000000000 +0100
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: msgpack
 version: !ruby/object:Gem::Version
-  version: 1.0.3
+  version: 1.1.0
 platform: ruby
 authors:
 - Sadayuki Furuhashi
@@ -10,7 +10,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2017-01-25 00:00:00.000000000 Z
+date: 2017-02-28 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: bundler
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/factory_spec.rb new/spec/factory_spec.rb
--- old/spec/factory_spec.rb    2017-01-25 07:00:26.000000000 +0100
+++ new/spec/factory_spec.rb    2017-02-28 05:17:49.000000000 +0100
@@ -208,6 +208,41 @@
       my.a.should == 1
       my.b.should == 2
     end
+
+    describe "registering an ext type for a module" do
+      before do
+        mod = Module.new do
+          def self.from_msgpack_ext(data)
+            "unpacked #{data}"
+          end
+
+          def to_msgpack_ext
+            'value_msgpacked'
+          end
+        end
+        stub_const('Mod', mod)
+      end
+      let(:factory) { described_class.new }
+      before { factory.register_type(0x01, Mod) }
+
+      describe "packing an object whose class included the module" do
+        subject { factory.packer.pack(value).to_s }
+        before { stub_const('Value', Class.new{ include Mod }) }
+        let(:value) { Value.new }
+        it { is_expected.to eq "\xC7\x0F\x01value_msgpacked" }
+      end
+
+      describe "packing an object which has been extended by the module" do
+        subject { factory.packer.pack(object).to_s }
+        let(:object) { Object.new.extend Mod }
+        it { is_expected.to eq "\xC7\x0F\x01value_msgpacked" }
+      end
+
+      describe "unpacking with the module" do
+        subject { factory.unpacker.feed("\xC7\x06\x01module").unpack }
+        it { is_expected.to eq "unpacked module" }
+      end
+    end
   end
 
   describe 'the special treatment of symbols with ext type' do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/packer_spec.rb new/spec/packer_spec.rb
--- old/spec/packer_spec.rb     2017-01-25 07:00:26.000000000 +0100
+++ new/spec/packer_spec.rb     2017-02-28 05:17:49.000000000 +0100
@@ -350,6 +350,42 @@
       end
     end
 
+    context 'when it has no ext type but an included module has' do
+      subject { packer.pack(Value.new).to_s }
+
+      before do
+        mod = Module.new do
+          def to_msgpack_ext
+            'value_msgpacked'
+          end
+        end
+        stub_const('Mod', mod)
+      end
+      before { packer.register_type(0x01, Mod, :to_msgpack_ext) }
+
+      before { stub_const('Value', Class.new{ include Mod }) }
+
+      it { is_expected.to eq "\xC7\x0F\x01value_msgpacked" }
+    end
+
+    context 'when it has no ext type but it was extended by a module which has 
one' do
+      subject { packer.pack(object).to_s }
+      let(:object) { Object.new.extend Mod }
+
+      before do
+        mod = Module.new do
+          def to_msgpack_ext
+            'value_msgpacked'
+          end
+        end
+        stub_const('Mod', mod)
+      end
+      before { packer.register_type(0x01, Mod, :to_msgpack_ext) }
+
+
+      it { is_expected.to eq "\xC7\x0F\x01value_msgpacked" }
+    end
+
     context 'when registering a type for symbols' do
       before { packer.register_type(0x00, ::Symbol, :to_msgpack_ext) }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/unpacker_spec.rb new/spec/unpacker_spec.rb
--- old/spec/unpacker_spec.rb   2017-01-25 07:00:26.000000000 +0100
+++ new/spec/unpacker_spec.rb   2017-02-28 05:17:49.000000000 +0100
@@ -477,6 +477,24 @@
       expect(two[:class]).to be_nil
       expect(two[:unpacker]).to be_instance_of(Proc)
     end
+
+    describe "registering an ext type for a module" do
+      subject { unpacker.feed("\xc7\x06\x00module").unpack }
+
+      let(:unpacker) { MessagePack::Unpacker.new }
+
+      before do
+        mod = Module.new do
+          def self.from_msgpack_ext(data)
+            "unpacked #{data}"
+          end
+        end
+        stub_const('Mod', mod)
+      end
+
+      before { unpacker.register_type(0x00, Mod, :from_msgpack_ext) }
+      it { is_expected.to eq "unpacked module" }
+    end
   end
 
   def flatten(struct, results = [])


Reply via email to