diff options
author | ThibG <thib@sitedethib.com> | 2021-01-26 23:21:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-26 23:21:32 +0100 |
commit | 52ff3ca675ecac0ff32990b6321fb5e349e6dc59 (patch) | |
tree | eeeeeead25872b19b34b31e3ccbd543d3e2fd9b8 /app/lib/extractor.rb | |
parent | ca6c62068e35537251cc650c8b2d03a1a2163d06 (diff) | |
parent | 00e55445b9aa5a399a9f8b76e42fde9da2c399fd (diff) |
Merge pull request #1491 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/lib/extractor.rb')
-rw-r--r-- | app/lib/extractor.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/lib/extractor.rb b/app/lib/extractor.rb index 479689d60..6076458ad 100644 --- a/app/lib/extractor.rb +++ b/app/lib/extractor.rb @@ -7,14 +7,14 @@ module Extractor # :yields: username, list_slug, start, end def extract_mentions_or_lists_with_indices(text) - return [] unless text =~ Twitter::Regex[:at_signs] + return [] unless Twitter::Regex[:at_signs].match?(text) possible_entries = [] text.to_s.scan(Account::MENTION_RE) do |screen_name, _| match_data = $LAST_MATCH_INFO after = $' - unless after =~ Twitter::Regex[:end_mention_match] + unless Twitter::Regex[:end_mention_match].match?(after) start_position = match_data.char_begin(1) - 1 end_position = match_data.char_end(1) possible_entries << { @@ -33,7 +33,7 @@ module Extractor end def extract_hashtags_with_indices(text, **) - return [] unless text =~ /#/ + return [] unless /#/.match?(text) tags = [] text.scan(Tag::HASHTAG_RE) do |hash_text, _| @@ -41,7 +41,7 @@ module Extractor start_position = match_data.char_begin(1) - 1 end_position = match_data.char_end(1) after = $' - if after =~ %r{\A://} + if %r{\A://}.match?(after) hash_text.match(/(.+)(https?\Z)/) do |matched| hash_text = matched[1] end_position -= matched[2].char_length |