From: tpo2@sourcepole.ch (Tomas Pospisek ML)
Subject: [sup-talk] patch: pluralize minute(s) second(s)
Date: Thu, 30 Oct 2008 23:38:07 +0000 [thread overview]
Message-ID: <jmft2NPp.1225409887.1308060.tpo2@192.168.3.7> (raw)
The patch below makes Sup say "1 second" instead of "1 seconds". Same
for minute(s).
*t
--- lib/sup/index.rb.orig 2008-10-31 00:03:41.000000000 +0100
+++ lib/sup/index.rb 2008-10-31 00:05:24.000000000 +0100
@@ -66,14 +66,19 @@
@lock_update_thread = nil
end
+ def possibly_pluralize number_of, kind
+ "#{number_of} #{kind}" +
+ if number_of == 1 then "" else "s" end
+ end
+
def fancy_lock_error_message_for e
- secs = Time.now - e.mtime
- mins = secs.to_i / 60
+ secs = (Time.now - e.mtime).to_i
+ mins = secs / 60
time =
if mins == 0
- "#{secs.to_i} seconds"
+ possibly_pluralize secs , "second"
else
- "#{mins} minutes"
+ possibly_pluralize mins, "minute"
end
<<EOS
next reply other threads:[~2008-10-30 23:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-30 23:38 Tomas Pospisek ML [this message]
2008-11-02 18:58 ` William Morgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jmft2NPp.1225409887.1308060.tpo2@192.168.3.7 \
--to=tpo2@sourcepole.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox