lib/ppl/command/mutt.rb in ppl-1.17.0 vs lib/ppl/command/mutt.rb in ppl-1.17.1
- old
+ new
@@ -37,10 +37,11 @@
end
def select_matching_contacts(address_book, query)
matches = Ppl::Entity::AddressBook.new
address_book.contacts.each do |contact|
+ contact = contact.dup
if contact.email_addresses.empty?
next
elsif match_by_name(contact, query)
matches.contacts << contact
elsif match_by_email_address(contact, query)
@@ -80,12 +81,12 @@
end
end
def describe_matches(matches)
summary = sprintf(
- "Searching address book... %d entries... %d matching:",
- @address_book.contacts.length,
- matches.contacts.length
+ "Searching address book... %d email addresses... %d matching:",
+ @address_book.contacts.inject(0) { |total, c| total += c.email_addresses.length },
+ matches.contacts.inject(0) { |total, c| total += c.email_addresses.length }
)
results = @format.process(matches)
[summary, results].join("\n").strip
end