Sha256: 94fa8e61992258357093434f354390eb28d85ad3d2da37f06298c89cb1691e00
Contents?: true
Size: 968 Bytes
Versions: 3
Compression:
Stored size: 968 Bytes
Contents
module Redwood class Tagger def initialize mode @mode = mode @tagged = {} end def tagged? o; @tagged[o]; end def toggle_tag_for o; @tagged[o] = !@tagged[o]; end def drop_all_tags; @tagged.clear; end def drop_tag_for o; @tagged.delete o; end def apply_to_tagged targets = @tagged.select_by_value num_tagged = targets.size if num_tagged == 0 BufferManager.flash "No tagged threads!" return end noun = num_tagged == 1 ? "thread" : "threads" c = BufferManager.ask_getch "apply to #{num_tagged} tagged #{noun}:" return if c.nil? # user cancelled if(action = @mode.resolve_input(c)) tagged_sym = "multi_#{action}".intern if @mode.respond_to? tagged_sym @mode.send tagged_sym, targets else BufferManager.flash "That command cannot be applied to multiple threads." end else BufferManager.flash "Unknown command #{c.to_character}." end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sup-0.1 | lib/sup/tagger.rb |
sup-0.2 | lib/sup/tagger.rb |
sup-0.3 | lib/sup/tagger.rb |