You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sam Ruby <ru...@apache.org> on 2016/02/22 04:11:06 UTC
[whimsy.git] [1/1] Commit 9f478cf: avoid weakrefs with Ruby 1.9.x
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 <ru...@intertwingly.net>
Committer: Sam Ruby <ru...@intertwingly.net>
Pusher: rubys <ru...@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