-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

NAKAMURA, Hiroshi wrote:
> Still have the problem?  Can you show me an actual gem of win32-api and
> the gems index that caused the problem?
> 
> I created a soap4r gem and gems index with svn trunk (0.9.4.6?) but I
> can install it with 0.9.4.  On the machine that uses 0.9.4, loading the
> Marshal index 'Marshal.4.8' caused an error but I think source_index.rb
> in 0.9.4 doesn't try to fetch the Marshal gem index.  And the error I
> got is different from the one Dan got.  How I can get the TypeError above?

Reply to myself with a quicky patch.  Request for review.

Regards,
// NaHi

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)

iQEVAwUBRyXwHx9L2jg5EEGlAQLFagf+PaLKFSKgjXl86mNbCcCcBtboXOrmth/d
kT1s+zg4eMj6fV7gos028WfTgZDYvzTh3UQ6WVWb6reX76StZlINEIlI6oMEuUlB
82j5uy1+Y9P0jcM5bxAyOfb/i6O55ppD3D3VbJkCtHJUp8MU0VAdTN2WZvM27vyX
Tn8K3IqeJ5aDrNcjNf/qQT7Khf4eOtsFofX6UTRETMLAqij+TRueYAi03dTnw01q
iJWlO54Dbtwq5W+b2tI0GBX9RQQ3Lxa2eZcYb/uIauHHcjM6T4sexg20ry0vF87o
AT7gt8kU0tz2lZ+nX/bnuhAfRjpUQ+0kFTLpckcNOId5G12SN2WjxQ==
=YiER
-----END PGP SIGNATURE-----
Index: test/test_gem_platform.rb
===================================================================
--- test/test_gem_platform.rb   (revision 1482)
+++ test/test_gem_platform.rb   (working copy)
@@ -65,6 +65,11 @@
       platform = Gem::Platform.new arch
       assert_equal expected, platform.to_a, arch.inspect
     end
+
+    test_cases.each do |arch, expected|
+      platform = YAML.load((Gem::Platform.new arch).to_yaml)
+      assert_equal expected, platform.to_a, arch.inspect
+    end
   end
 
   def test_initialize_command_line
Index: lib/rubygems/specification.rb
===================================================================
--- lib/rubygems/specification.rb       (revision 1482)
+++ lib/rubygems/specification.rb       (working copy)
@@ -522,6 +522,18 @@
       @@gather.call(self) if @@gather
     end
 
+    def yaml_initialize(tag, val)
+      val.each do |ivar, value|
+        if ivar == "platform" and
+            !value.nil? and             # platform can be nil
+            !(String === value) and     # for old format: "ruby"
+            !(Platform === value)       # no need to convert
+          value = Platform.new value
+        end
+        instance_variable_set "@#{ivar}", value
+      end
+    end
+
     # Each attribute has a default value (possibly nil).  Here, we
     # initialize all attributes to their default value.  This is
     # done through the accessor methods, so special behaviours will
Index: lib/rubygems/platform.rb
===================================================================
--- lib/rubygems/platform.rb    (revision 1482)
+++ lib/rubygems/platform.rb    (working copy)
@@ -87,6 +87,10 @@
     to_a.compact.join '-'
   end
 
+  def to_yaml(opt = {})
+    to_a.to_yaml(opt)
+  end
+
   def ==(other)
     self.class === other and
       @cpu == other.cpu and @os == other.os and @version == other.version
_______________________________________________
Rubygems-developers mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to