Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/sup/thread.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,17 @@ def participants
end

def size; map { |m, *o| m ? 1 : 0 }.sum; end
def subj; argfind { |m, *o| m && m.subj }; end

def find_last
ret = nil
find_all { |e| ret = yield(e) }
ret || nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nil or nil?

end

def subj
find_last { |m, *o| m && m.subj }
end

def labels; inject(Set.new) { |s, (m, *o)| m ? s | m.labels : s } end
def labels= l
raise ArgumentError, "not a set" unless l.is_a?(Set)
Expand Down