From 3fade34834e95b860d6c774453b6bcc602a7b58f Mon Sep 17 00:00:00 2001 From: Artem Darius Weber Date: Thu, 2 Jan 2025 15:23:18 +0300 Subject: [PATCH] refactor: remove git validation from initializer and add setter method in Person class --- lab2/person.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lab2/person.rb b/lab2/person.rb index 506dd81..09ad955 100644 --- a/lab2/person.rb +++ b/lab2/person.rb @@ -5,7 +5,6 @@ class Person def initialize(id:, git:, contact: Contact.new) validate_id(id) - validate_git(git) validate_contact(contact) @id = id @@ -33,6 +32,11 @@ class Person id.is_a?(String) && !id.strip.empty? end + def git=(git) + validate_git(git) + @git = git + end + private def validate_id(id)