class Printer

Public Instance Methods

email_all() click to toggle source
# File lib/cyrus-code-challenge/printer.rb, line 54
def email_all
  [email_output_1, email_output_2, email_output_3]
end
email_output_1() click to toggle source
# File lib/cyrus-code-challenge/printer.rb, line 33
def email_output_1
  contacts = sorted_by_ascending_gender_and_last_name
  contacts.map do |contact|
    "#{contact.last_name} #{contact.first_name} #{contact.gender} #{contact.birth_date.strftime("%-m/%-d/%Y")} #{contact.favorite_color}"
  end
end
email_output_2() click to toggle source
# File lib/cyrus-code-challenge/printer.rb, line 40
def email_output_2
  contacts = sorted_by_ascending_birthdate_and_last_name
  contacts.map do |contact|
    "#{contact.last_name} #{contact.first_name} #{contact.gender} #{contact.birth_date.strftime("%-m/%-d/%Y")} #{contact.favorite_color}"
  end
end
email_output_3() click to toggle source
# File lib/cyrus-code-challenge/printer.rb, line 47
def email_output_3
  contacts = sorted_by_last_name_descending
  contacts.map do |contact|
    "#{contact.last_name} #{contact.first_name} #{contact.gender} #{contact.birth_date.strftime("%-m/%-d/%Y")} #{contact.favorite_color}"
  end
end
output_1() click to toggle source
# File lib/cyrus-code-challenge/printer.rb, line 9
def output_1
  puts "", "Output 1:"
  contacts = sorted_by_ascending_gender_and_last_name
  contacts.each do |contact|
    puts "#{contact.last_name} #{contact.first_name} #{contact.gender} #{contact.birth_date.strftime("%-m/%-d/%Y")} #{contact.favorite_color}"
  end; puts""
end
output_2() click to toggle source
# File lib/cyrus-code-challenge/printer.rb, line 17
def output_2
  puts "Output 2:"
  contacts = sorted_by_ascending_birthdate_and_last_name
  contacts.each do |contact|
    puts "#{contact.last_name} #{contact.first_name} #{contact.gender} #{contact.birth_date.strftime("%-m/%-d/%Y")} #{contact.favorite_color}"
  end; puts""
end
output_3() click to toggle source
# File lib/cyrus-code-challenge/printer.rb, line 25
def output_3
  puts "Output 3:"
  contacts = sorted_by_last_name_descending
  contacts.each do |contact|
    puts "#{contact.last_name} #{contact.first_name} #{contact.gender} #{contact.birth_date.strftime("%-m/%-d/%Y")} #{contact.favorite_color}"
  end; puts""
end
print_all() click to toggle source