diff --git a/lab2/student.rb b/lab2/student.rb index 46ae085..0ba74f2 100644 --- a/lab2/student.rb +++ b/lab2/student.rb @@ -1,15 +1,17 @@ class Student attr_accessor :id, :surname, :name, :patronymic, :phone, :telegram, :email, :git - - def initialize(surname:, name:, patronymic:, id: nil, phone: nil, telegram: nil, email: nil, git: nil) - @surname = surname - @name = name - @patronymic = patronymic - @id = id - @phone = phone - @telegram = telegram - @email = email - @git = git + + def initialize(args = {}) + @surname = args.fetch(:surname) + @name = args.fetch(:name) + @patronymic = args.fetch(:patronymic) + + + @id = args[:id] || nil + @phone = args[:phone] || nil + @telegram = args[:telegram] || nil + @email = args[:email] || nil + @git = args[:git] || nil end def to_s