On Tue, Mar 15, 2016 at 12:10 PM, Sebastian Bazley <s...@apache.org> wrote: > Commit 6c2b651834355a5e677906b939449e43fb6b38e3: > to_h is relatively new; allow code to run on older Ruby versions
Looks messy. :-) I propose the following as a cleaner implementation: https://github.com/apache/whimsy/commit/a8acbc8b6f7a64a1372348cc62b8c796c7f077c8 - Sam Ruby > Branch: refs/heads/master > Author: Sebb <s...@apache.org> > Committer: Sebb <s...@apache.org> > Pusher: sebb <s...@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