From 0b3d3153700afaa18e2c3d4c873ccd55b0582279 Mon Sep 17 00:00:00 2001 From: Artem Darius Weber Date: Thu, 2 Jan 2025 15:15:40 +0300 Subject: [PATCH] refactor: rename info method to get_single_contact in Contact class and update references --- lab2/contact.rb | 3 +-- lab2/main.rb | 2 +- lab2/person.rb | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lab2/contact.rb b/lab2/contact.rb index 8675da4..056aac4 100644 --- a/lab2/contact.rb +++ b/lab2/contact.rb @@ -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 diff --git a/lab2/main.rb b/lab2/main.rb index 44796f1..58fd1f7 100644 --- a/lab2/main.rb +++ b/lab2/main.rb @@ -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}" diff --git a/lab2/person.rb b/lab2/person.rb index 0e17ac3..506dd81 100644 --- a/lab2/person.rb +++ b/lab2/person.rb @@ -22,7 +22,7 @@ class Person end def contact_info - @contact.info + @contact.get_single_contact end def self.valid_git?(git)