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 c5c4e8c  Extract normalize into separate method
c5c4e8c is described below

commit c5c4e8c67c15aa235d939e05c975c002633d16bc
Author: Sebb <[email protected]>
AuthorDate: Sun Jul 12 01:23:54 2020 +0100

    Extract normalize into separate method
---
 lib/whimsy/asf/member.rb | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/whimsy/asf/member.rb b/lib/whimsy/asf/member.rb
index 5a331b0..1592a34 100644
--- a/lib/whimsy/asf/member.rb
+++ b/lib/whimsy/asf/member.rb
@@ -164,14 +164,18 @@ module ASF
       text
     end
 
-    # update local copy of members.txt
-    def self.text=(text)
-      # normalize text: sort and update active count
+    # normalize text: sort and update active count
+    def self.normalize(text)
       text = ASF::Member.sort(text)
       pattern = /^Active.*?^=+\n+(.*?)^Emeritus/m
       text[/We now number (\d+) active members\./, 1] =
         text[pattern].scan(/^\s\*\)\s/).length.to_s
+      text
+    end
 
+    # update local copy of members.txt
+    def self.text=(text)
+      text = self.normalize(text)
       # save
       @@mtime = Time.now
       @@text = WeakRef.new(text)

Reply via email to