FIX: marshallable support for dates

FIX: marshallable support for dates

diff --git a/lib/mini_sql/serializer.rb b/lib/mini_sql/serializer.rb
index 3b023a1..54bce39 100644
--- a/lib/mini_sql/serializer.rb
+++ b/lib/mini_sql/serializer.rb
@@ -12,12 +12,12 @@ module MiniSql
       new(result)
     end
 
-    def _dump(level)
-      JSON.generate(serialize)
+    def marshal_dump
+      serialize
     end
 
-    def self._load(dump)
-      materialize(JSON.parse(dump))
+    def marshal_load(wrapper)
+      replace self.class.materialize(wrapper)
     end
 
     private
diff --git a/test/mini_sql/connection_tests.rb b/test/mini_sql/connection_tests.rb
index 2b58462..a67bab4 100644
--- a/test/mini_sql/connection_tests.rb
+++ b/test/mini_sql/connection_tests.rb
@@ -152,12 +152,13 @@ module MiniSql::ConnectionTests
   end
 
   def test_serializer_marshal
-    r = @connection.query("select 1 one, 'two' two")
+    r = @connection.query("select 1 one, 'two' two, 'now'::date today")
     dump = Marshal.dump(MiniSql::Serializer.marshallable(r))
     r = Marshal.load(dump)
 
     assert_equal(r[0].one, 1)
     assert_equal(r[0].two, "two")
+    assert_equal(r[0].today, Date.today)
     assert_equal(r.length, 1)
   end
 

GitHub sha: a1c5d514

This commit appears in #26 which was merged by SamSaffron.