Class: Fonbok::Formatters::SimplePhonebookFormatter
- Inherits:
-
Object
- Object
- Fonbok::Formatters::SimplePhonebookFormatter
- Defined in:
- lib/fonbok/formatters/simple_phonebook_formatter.rb
Instance Method Summary collapse
Instance Method Details
#format(phonebook) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/fonbok/formatters/simple_phonebook_formatter.rb', line 4 def format(phonebook) phonebook.contacts.inject("#{phonebook.name}\n") do |contact_result, contact| contact_result << " #{contact.name}\n" contact.numbers.inject(contact_result) do |number_result, number| number_result << " #{number}\n" end end end |