From f0de4450e45ef4ad952f64cf6af3aeff2c847c45 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Tue, 17 Jan 2023 18:41:33 +0100 Subject: [PATCH] fix twitter --- app/services/contact_details/twitter.rb | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/app/services/contact_details/twitter.rb b/app/services/contact_details/twitter.rb index ccc59c045..407d0f2c0 100644 --- a/app/services/contact_details/twitter.rb +++ b/app/services/contact_details/twitter.rb @@ -1,10 +1,25 @@ -class ContactDetails::Twitter < ContactDetails::Website - ROOT = 'twitter.com/' +class ContactDetails::Twitter < ContactDetails::Base + URL = 'https://twitter.com' + DOMAIN = 'twitter.com' + protected + # arnaudlevy + # twitter.com/arnaudlevy + # https://twitter.com/arnaudlevy + # TODO vrais tests + def prepare_url + @url = @string + @url.remove! DOMAIN if @url.start_with? DOMAIN + @url.remove! URL if @url.start_with? URL + @url.delete_suffix! '/' + @url.delete_prefix! '/' + @url = "#{URL}/#{@string}" + end + def prepare_label super - @label.remove! ROOT + @label.remove! URL end end \ No newline at end of file -- GitLab