commit 8672ad32e972b0c80b5d36fc72f48a16ddff98bd
parent a8f534704de2687869b5b7e9d178518ac1500126
Author: William Morgan <wmorgan-sup@masanjin.net>
Date: Wed, 30 Jan 2008 22:19:04 -0800
Merge branch 'tag-nouns' into next
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/sup/modes/contact-list-mode.rb b/lib/sup/modes/contact-list-mode.rb
@@ -29,7 +29,7 @@ class ContactListMode < LineCursorMode
def initialize mode=:regular
@mode = mode
- @tags = Tagger.new self
+ @tags = Tagger.new self, "contact"
@num = nil
@text = []
super()
diff --git a/lib/sup/tagger.rb b/lib/sup/tagger.rb
@@ -1,9 +1,11 @@
module Redwood
class Tagger
- def initialize mode
+ def initialize mode, noun="thread", plural_noun=nil
@mode = mode
@tagged = {}
+ @noun = noun
+ @plural_noun = plural_noun || (@noun + "s")
end
def tagged? o; @tagged[o]; end
@@ -21,7 +23,7 @@ class Tagger
return
end
- noun = num_tagged == 1 ? "thread" : "threads"
+ noun = num_tagged == 1 ? @noun : @plural_noun
unless action
c = BufferManager.ask_getch "apply to #{num_tagged} tagged #{noun}:"