refactor: rename info method to get_single_contact in Contact class and update references

lab2
Artem-Darius Weber 1 week ago
parent 4e91bae07c
commit 0b3d315370

@ -21,8 +21,7 @@ class Contact
@phone || @telegram || @email
end
# getSingleContact
def info
def get_single_contact
return "Phone: #{@phone}" if @phone
return "Telegram: #{@telegram}" if @telegram
return "Email: #{@email}" if @email

@ -8,7 +8,7 @@ require_relative 'binary_search_tree'
def test_classes
contact = Contact.new(phone: '+798912465', telegram: '@example_user', email: 'test@example.com')
puts "Contact Info: #{contact.info}"
puts "Contact Info: #{contact.get_single_contact}"
person = Person.new(id: '1', git: 'https://github.com/example', contact: contact)
puts "Person Contact Info: #{person.contact_info}"

@ -22,7 +22,7 @@ class Person
end
def contact_info
@contact.info
@contact.get_single_contact
end
def self.valid_git?(git)

Loading…
Cancel
Save