whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Bazley <s...@apache.org>
Subject [whimsy.git] [1/1] Commit 6c2b651: to_h is relatively new; allow code to run on older Ruby versions
Date Tue, 15 Mar 2016 16:10:14 GMT
Commit 6c2b651834355a5e677906b939449e43fb6b38e3:
    to_h is relatively new; allow code to run on older Ruby versions


Branch: refs/heads/master
Author: Sebb <sebb@apache.org>
Committer: Sebb <sebb@apache.org>
Pusher: sebb <sebb@apache.org>

------------------------------------------------------------
www/roster/models/group.rb                                   | ++++++++ ---
------------------------------------------------------------
22 changes: 16 additions, 6 deletions.
------------------------------------------------------------


diff --git a/www/roster/models/group.rb b/www/roster/models/group.rb
index acc40e9..0015b1d 100644
--- a/www/roster/models/group.rb
+++ b/www/roster/models/group.rb
@@ -8,16 +8,26 @@ def self.list
     groups = ASF::Group.list.map(&:id)
     groups -= ASF::Committee.list.map(&:id)
     groups.map! {|group| [group, "LDAP group"]}
-
     # add services...
     groups += ASF::Service.list.map {|service| [service, "LDAP service"]}
 
     # add authorization (asf and pit)
-    groups += ASF::Authorization.new('asf').to_h.
-      map {|id, list| [id, "ASF Auth"]}
-
-    groups += ASF::Authorization.new('pit').to_h.
-      map {|id, list| [id, "PIT Auth"]}
+    begin
+      groups += ASF::Authorization.new('asf').to_h.
+        map {|id, list| [id, "ASF Auth"]}
+    rescue # in case to_h does not work
+      ASF::Authorization.new('asf').each do |id,list|
+        groups += [[id, "ASF Auth"]]
+      end
+    end
+    begin
+      groups += ASF::Authorization.new('pit').to_h.
+        map {|id, list| [id, "PIT Auth"]}
+    rescue # in case to_h does not work
+      ASF::Authorization.new('pit').each do |id,list|
+        groups += [[id, "PIT Auth"]]
+      end
+    end
 
     groups.sort
   end

Mime
View raw message