|
|
|
@ -29,23 +29,18 @@ class Contact
|
|
|
|
|
'No contact available'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def valid_phone_number?(phone)
|
|
|
|
|
def self.valid_phone_number?(phone)
|
|
|
|
|
/\A\+?[0-9]{9,15}\z/.match?(phone)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# self
|
|
|
|
|
def valid_telegram?(telegram)
|
|
|
|
|
def self.valid_telegram?(telegram)
|
|
|
|
|
/\A@[A-Za-z0-9_]{5,32}\z/.match?(telegram)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def valid_email?(email)
|
|
|
|
|
def self.valid_email?(email)
|
|
|
|
|
/\A[^@\s]+@[^@\s]+\.[^@\s]+\z/.match?(email)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
|
|
|
|
|
def self.new_from_info(info_string)
|
|
|
|
|
info_string = info_string.sub(/^Contact: /, '').strip
|
|
|
|
|
|
|
|
|
|