|
|
@ -4,6 +4,12 @@ require_relative 'contact'
|
|
|
|
class Student < Person
|
|
|
|
class Student < Person
|
|
|
|
attr_accessor :surname, :name, :patronymic, :birth_date
|
|
|
|
attr_accessor :surname, :name, :patronymic, :birth_date
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NAME_REGEX = /\A[А-Яа-яЁёA-Za-z\-]+\z/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
|
|
|
|
|
|
|
def initialize(id:, git:, contact:, surname: nil, name: nil, patronymic: nil, birth_date: nil)
|
|
|
|
def initialize(id:, git:, contact:, surname: nil, name: nil, patronymic: nil, birth_date: nil)
|
|
|
|
super(id: id, git: git, contact: contact)
|
|
|
|
super(id: id, git: git, contact: contact)
|
|
|
|
@surname = surname
|
|
|
|
@surname = surname
|
|
|
@ -83,7 +89,6 @@ class Student < Person
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def self.valid_name?(name)
|
|
|
|
def self.valid_name?(name)
|
|
|
|
NAME_REGEX = /\A[А-Яа-яЁёA-Za-z\-]+\z/
|
|
|
|
|
|
|
|
NAME_REGEX.match?(name)
|
|
|
|
NAME_REGEX.match?(name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|