lib/sup/thread.rb in sup-1.1 vs lib/sup/thread.rb in sup-1.2

- old
+ new

@@ -84,26 +84,26 @@ fake_root && c.message.nil? && root.nil? && c == fud end end end - def first; each { |m, *o| return m if m }; nil; end - def has_message?; any? { |m, *o| m.is_a? Message }; end - def dirty?; any? { |m, *o| m && m.dirty? }; end - def date; map { |m, *o| m.date if m }.compact.max; end + def first; each { |m, *| return m if m }; nil; end + def has_message?; any? { |m, *| m.is_a? Message }; end + def dirty?; any? { |m, *| m && m.dirty? }; end + def date; map { |m, *| m.date if m }.compact.max; end def snippet - with_snippets = select { |m, *o| m && m.snippet && !m.snippet.empty? } - first_unread, * = with_snippets.select { |m, *o| m.has_label?(:unread) }.sort_by { |m, *o| m.date }.first + with_snippets = select { |m, *| m && m.snippet && !m.snippet.empty? } + first_unread, * = with_snippets.select { |m, *| m.has_label?(:unread) }.sort_by { |m, *| m.date }.first return first_unread.snippet if first_unread - last_read, * = with_snippets.sort_by { |m, *o| m.date }.last + last_read, * = with_snippets.sort_by { |m, *| m.date }.last return last_read.snippet if last_read "" end - def authors; map { |m, *o| m.from if m }.compact.uniq; end + def authors; map { |m, *| m.from if m }.compact.uniq; end - def apply_label t; each { |m, *o| m && m.add_label(t) }; end - def remove_label t; each { |m, *o| m && m.remove_label(t) }; end + def apply_label t; each { |m, *| m && m.add_label(t) }; end + def remove_label t; each { |m, *| m && m.remove_label(t) }; end def toggle_label label if has_label? label remove_label label false @@ -111,28 +111,28 @@ apply_label label true end end - def set_labels l; each { |m, *o| m && m.labels = l }; end - def has_label? t; any? { |m, *o| m && m.has_label?(t) }; end - def each_dirty_message; each { |m, *o| m && m.dirty? && yield(m) }; end + def set_labels l; each { |m, *| m && m.labels = l }; end + def has_label? t; any? { |m, *| m && m.has_label?(t) }; end + def each_dirty_message; each { |m, *| m && m.dirty? && yield(m) }; end def direct_participants - map { |m, *o| [m.from] + m.to if m }.flatten.compact.uniq + map { |m, *| [m.from] + m.to if m }.flatten.compact.uniq end def participants - map { |m, *o| [m.from] + m.to + m.cc + m.bcc if m }.flatten.compact.uniq + map { |m, *| [m.from] + m.to + m.cc + m.bcc if m }.flatten.compact.uniq end - def size; map { |m, *o| m ? 1 : 0 }.sum; end - def subj; argfind { |m, *o| m && m.subj }; end - def labels; inject(Set.new) { |s, (m, *o)| m ? s | m.labels : s } end + def size; map { |m, *| m ? 1 : 0 }.sum; end + def subj; argfind { |m, *| m && m.subj }; end + def labels; inject(Set.new) { |s, (m, *)| m ? s | m.labels : s } end def labels= l raise ArgumentError, "not a set" unless l.is_a?(Set) - each { |m, *o| m && m.labels = l.dup } + each { |m, *| m && m.labels = l.dup } end def latest_message inject(nil) do |a, b| b = b.first @@ -358,10 +358,10 @@ end ## merges in a pre-loaded thread def add_thread t raise "duplicate" if @threads.values.member? t - t.each { |m, *o| add_message m } + t.each { |m, *| add_message m } end ## merges two threads together. both must be members of this threadset. ## does its best, heuristically, to determine which is the parent. def join_threads threads