This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new a85b6a56 Provide hash of entry statuses
a85b6a56 is described below

commit a85b6a5601fa3731f640843422a4b53e53b7082c
Author: Sebb <[email protected]>
AuthorDate: Wed Feb 8 23:21:51 2023 +0000

    Provide hash of entry statuses
---
 lib/whimsy/asf/member.rb | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/lib/whimsy/asf/member.rb b/lib/whimsy/asf/member.rb
index c5589015..1f714d5d 100644
--- a/lib/whimsy/asf/member.rb
+++ b/lib/whimsy/asf/member.rb
@@ -45,13 +45,21 @@ module ASF
     end
 
     # return the status of a member:
-    # - nil
+    # - nil - id not found
     # - :current
     # - :emeritus
     # - :deceased
     def self.member_status(id)
       entry = list[id]
       return nil if entry.nil?
+      _entry_status(entry)
+    end
+
+    # return the status of an entry:
+    # - :current
+    # - :emeritus
+    # - :deceased
+    def self._entry_status(entry)
       status = entry['status']
       case status
       when nil
@@ -65,6 +73,14 @@ module ASF
       end
     end
 
+    # return a hash of all the member ids and their status:
+    # - :current
+    # - :emeritus
+    # - :deceased
+    def self.member_statuses
+      self.list.map { |id, v| [id, self._entry_status(v)]}.to_h
+    end
+
     # Find the ASF::Person associated with a given email
     def self.find_by_email(value)
       value = value.downcase

Reply via email to