* [sup-talk] patch: pluralize minute(s) second(s)
@ 2008-10-30 23:38 Tomas Pospisek ML
2008-11-02 18:58 ` William Morgan
0 siblings, 1 reply; 2+ messages in thread
From: Tomas Pospisek ML @ 2008-10-30 23:38 UTC (permalink / 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [sup-talk] patch: pluralize minute(s) second(s)
2008-10-30 23:38 [sup-talk] patch: pluralize minute(s) second(s) Tomas Pospisek ML
@ 2008-11-02 18:58 ` William Morgan
0 siblings, 0 replies; 2+ messages in thread
From: William Morgan @ 2008-11-02 18:58 UTC (permalink / raw)
Reformatted excerpts from Tomas Pospisek ML's message of 2008-10-30:
> The patch below makes Sup say "1 second" instead of "1 seconds". Same
> for minute(s).
Applied, thanks! It will be a little easier for me in the future if you
can use git to generate the patches. But it's not vital. See
http://sup.rubyforge.org/wiki/wiki.pl?Contributing
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-02 18:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-30 23:38 [sup-talk] patch: pluralize minute(s) second(s) Tomas Pospisek ML
2008-11-02 18:58 ` William Morgan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox