whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] 01/02: rename prefixNumber to ordinalize
Date Wed, 23 May 2018 17:03:23 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 6610dedccb4f4bed431c0ac5d4fe96bf8bad9223
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Wed May 23 12:24:19 2018 -0400

    rename prefixNumber to ordinalize
---
 www/board/agenda/views/committers_report.text.rb | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/www/board/agenda/views/committers_report.text.rb b/www/board/agenda/views/committers_report.text.rb
index 930d472..341828d 100644
--- a/www/board/agenda/views/committers_report.text.rb
+++ b/www/board/agenda/views/committers_report.text.rb
@@ -3,13 +3,15 @@ require 'chronic'
 ## This is a script to generate an email for committers@apache.org
 
 # Add the right prefix to a number
-def prefixNumber(number) 
-  if number % 10 == 1
-    number.to_s + "st"
-  elsif number % 10 == 2
-    number.to_s + "nd"
-  else
-    number.to_s + "th"
+class Integer
+  def ordinalize
+    if self % 10 == 1
+      self.to_s + "st"
+    elsif self % 10 == 2
+      self.to_s + "nd"
+    else
+      self.to_s + "th"
+    end
   end
 end
 
@@ -82,7 +84,7 @@ end
 ##### 7: Find out the date of the next board report
 
 next_meeting = ASF::Board.nextMeeting
-@next_meeting = prefixNumber(next_meeting.day) + " of " + 
+@next_meeting = next_meeting.day.ordinalize + " of " + 
   next_meeting.strftime('%B')
 
 if !approved_minutes.empty?
@@ -103,7 +105,7 @@ To: committers@apache.org
 Reply-To: board@apache.org
 Subject: ASF Board Meeting Summary - #{@date.strftime('%B %d, %Y')}
 
-The #{@date.strftime('%B')} board meeting took place on the #{prefixNumber(@date.day)}.
+The #{@date.strftime('%B')} board meeting took place on the #{@date.day.ordinalize}.
 
 <%#
 

-- 
To stop receiving notification emails like this one, please contact
rubys@apache.org.

Mime
View raw message