whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [1/1] Commit 9f478cf: avoid weakrefs with Ruby 1.9.x
Date Mon, 22 Feb 2016 03:11:06 GMT
Commit 9f478cff5f0348c030bf0ad6e14eff3db73eeae8:
    avoid weakrefs with Ruby 1.9.x
    Seeing weird results... for example, ASF.members returning a string.
    Does not occur with Ruby 2.3.0.


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
lib/whimsy/asf/ldap.rb                                       | +++ -
------------------------------------------------------------
4 changes: 3 additions, 1 deletions.
------------------------------------------------------------


diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index a884ca5..7109d17 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -175,7 +175,9 @@ def self.dereference_weakref(object, attr, &block)
   rescue WeakRef::RefError
     value = block.call
   ensure
-    if value and not value.instance_of? WeakRef
+    if not value or RUBY_VERSION.start_with? '1'
+      object.instance_variable_set(attr, value)
+    elsif value and not value.instance_of? WeakRef
       object.instance_variable_set(attr, WeakRef.new(value))
     end
   end

Mime
View raw message